Object Oriented Programming Questions and Answers

In this tutorial, we have covered Object Oriented Programming Questions and Answers freshers and experienced candidates.

This post on Object Oriented Programming Questions and Answers to help you understand the basic concepts of Java programming for interview purposes. All the important JAVA concepts are explained here with examples for your easy understanding.

Object Oriented Programming Questions and Answers
Object Oriented Programming Questions and Answers

Object Oriented Programming Questions and Answers

OOPS Concept

Q1) What is polymorphism?

Ans) Polymorphism gives us the ultimate flexibility in extensibility. The abiltiy to define more than one function with the same name is called Polymorphism. In java,c++ there are two type of polymorphism: compile time polymorphism (overloading) and runtime polymorphism (overriding).

When you override methods, JVM determines the proper methods to call at the program’s run time, not at the compile time. Overriding occurs when a class method has the same name and signature as a method in parent class.

Overloading occurs when several methods have same names with

  • Overloading is determined at the compile time.
  • Different method signature and different number or type of parameters.
  • Same method signature but different number of parameters.
  • Same method signature and same number of parameters but of different type

Example of Overloading

Q2) What is inheritance?

Ans) Inheritance is the property which allows a Child class to inherit some properties from its parent class. In Java this is achieved by using extends keyword. Only properties with access modifier public and protected can be accessed in child class.

public class Parent{

public String parentName;
public int parentage;
public String familyName;

public class Child extends Parent{

public String childName;
public int childAge;

public void printMyName(){
System.out.println(“ My name is “+ chidName+” “ +familyName)


In above example the child has inherit its family name from the parent class just by inheriting the class.

Q3) What is multiple inheritance and does java support?

Ans) If a child class inherits the property from multiple classes is known as multiple inheritance.
Java does not allow to extend multiple classes but to overcome this problem it allows to implement multiple Interfaces.

Q5) What is encapsulation?

Ans) The encapsulation is achieved by combining the methods and attribute into a class. The class acts like a container encapsulating the properties. The users are exposed mainly public methods.The idea behind is to hide how thinigs work and just exposing the requests a user can do.

Q6) What is Association?

Ans) Association is a relationship between two classes. In this relationship the object of one instance perform an action on behalf of the other class. The typical behaviour can be invoking the method of other class and using the member of the other class.

public class MyMainClass{

public void init(){

new OtherClass.init();



Q7) What is Aggregation?

Ans) Aggregation has a relationship between two classes. In this relationship the object of one class is a member of the other class. Aggregation always insists for a direction.

public class MyMainClass{

OtherClass otherClassObj = new OtherClass();


Q8) What is Composition?

Ans) Composition is a special type of aggregation relationship with a difference that its the compulsion for the OtherClass object (in previous example) to exist for the existence of MyMainClass.


These are some of the core JAVA interview questions that cover both the basic and advanced Java concepts for programming as well as developer interview, and these are ones which have been answered by our JAVA experts.

I hope that this tutorial would have given you a great insight into JAVA core coding concepts in detail. The explanations given above will really enrich your knowledge and increase your understanding of JAVA programming.

Get ready to crack an interview confidently !!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *