This document outlines the top 10 Java OOPs interview questions. It discusses key concepts like encapsulation, classes, objects, inheritance, polymorphism, and the 'this' and 'super' keywords. Encapsulation is defined as associating data with related methods in a class. Inheritance allows classes to inherit properties from parent classes and is used for code reusability. Polymorphism allows the same method name to be used for different parameters or signatures. The 'this' keyword refers to the current object, while 'super' accesses methods and properties of the parent class. Mastering these fundamental OOPs principles is important for Java interviews.
Micromeritics - Fundamental and Derived Properties of Powders
Top 10 java_oops_interview_questions
1. Top 10 Java Oops Interview Questions
http://crbtech.in/Student-Review
2. Top 10 Java Oops Interview Questions
http://crbtech.in/Student-Review
1.What exactly is the Java’s oops concept?
Oops is a methodology that gives a way for modularizing a program by developing a partitioned memory location
for both data and its methods that can be utilized as format for creating duplicates of such modules on interest.
The four types include:
Inheritance
Polymorphism
Encapsulation
Abstraction
3. Top 10 Java Oops Interview Questions
http://crbtech.in/Student-Review
2. What do you mean by encapsulation?
The process of associating data with related methods is called encapsulation. Class forms the core of this.
3. Define a class:
In case of oops, a class is a collection of variable/s and method/s for a particular type of object. An object is considered to be an instance of
a class. It happens to be a user defined data type in Java.
4. What do you mean by an object?
It forms an instance of a class. Object can be defined as any entity that has attributes, methods associated with it. An object is used to
allocate dynamic memory to a class.
5. State the object characteristics
The three characteristics of an object are:
Identity
Behavior
State
6. Explain inheritance
Self explanatory, it means to intake what already exists.
One of the most important concepts. The purpose is purely re-usability.
Used for inheriting properties from one class object to another one.
In simple terms, just like you inherit qualities from your parents!
4. Top 10 Java Oops Interview Questions
http://crbtech.in/Student-Review
7. How is inheritance put to use in Java?
Inheritance is used in Java with the help of two keywords namely ‘extends’ and
‘implements’.
With the help of ‘extends’, inheritance between two interfaces or classes can be
established. While,
‘implements’ is used to establish inheritance amongst interface and class.
e.g.
package com.instanceofjava;
class A{ }
package com.instanceofjava;
class B extends A{ }
5. Top 10 Java Oops Interview Questions
http://crbtech.in/Student-Review
8. State the different types of inheritances
Inheritance is divided into two main types namely-
Multiple inheritance
Multilevel inheritance
Multiple inheritance:
The funda of getting objects from multiple classes into single class object is called multiple inheritance. It is
not supported in Java programming.
Multilevel inheritance:
Getting properties from object of one class to another class object, is called multilevel inheritance.
e.g. package com.instanceofjava;
class A{ }
class B extends A{}
class C extends B{}
6. Top 10 Java Oops Interview Questions
http://crbtech.in/Student-Review
9. Define polymorphism
Using same names for more than one method.
One of the most popular java interview questions.
Two types are:
Static polymorphism and Dynamic polymorphism
Static:
Also called as method overloading
Multiple methods with same name and different parameters.
Dynamic:
Defining more than one methods with identical signature in sub class and super class.
The always executed method in this case will be sub most object.
7. Top 10 Java Oops Interview Questions
http://crbtech.in/Student-Review
10. Elaborate this and super keywords
Super:
A keyword used to store super class non -static members reference in sub class object.
Used to differentiate between sub class and super class members if the names are same.
System.out.println(super); would give compilation Error.
This:
Current object reference is stored in this.
Should be used when non-static variable and local variables’ name happens to be one.
System.out.print(this); would work fine.
So, these were some of the popular oops concepts and the very basic ones that form Java core interview questions.
There are many institutes present for Java training Pune. You can benefit by joining them.
8. Top 10 Java Oops Interview Questions
http://crbtech.in/Student-Review