Tutorials

Java OOP Interview Question


Java OOP Interview Question set1


Q1: What are important features of OOP programming?

Important features of OOP are:

  1. Abstraction
  2. Inheritance
  3. Polymorphism
  4. Encapsulation
  5. Class and Object

To read in details about each feature visit OOP section of our java tutorial-Click here

 


Q2: Difference between OOP and POP programming?

Basic difference between POP and OOP is given below:

 

POP vs OOP

POP

OOP

POP follows top down approach

OOP follows bottom up approach

In POP a program is divided into functions

In OOP a program is divided into objects

POP does not support access specifier

OOP support access specifier

POP does not allow overloading

OOP allows overloading

POP is less secure as it doesn’t have proper way of data hiding

POP is secure as it has proper way of data hiding

POP doesn’t support inheritance concept

OOP support inheritance concept

Example: C, Pascal, Fortran

Example: Java, C++, C#

 


Q3: What is inheritance and its type?

Inheritance is the property by virtue of which a class (termed as sub-class) acquires or inherits property of another class(termed as super-class).

 

We have following types of inheritance:

  1. Single inheritance
  2. Multilevel inheritance
  3. Hierarchal inheritance
  4. Multiple inheritance
  5. Hybrid inheritance

Learn about each of them in details in our java tutorial here

 


Q4: Which inheritance is not supported in java?

Multiple inheritance is not supported in java. 

As hybrid inheritance may include multiple inheritance as well so it is also not supported in java.

 


Q5: Why multiple inheritance is not supported in java?

In programming language like C++ that supports multiple inheritance, at times there arise ambiguity.

Suppose two classes which are inherited by any third class (or child class) has method with same name.

If that method is called from child class then which classes method should be called is not clear in this case. So this creates a ambiguous scenario.

 

We have already explained this with an example and diagrammatic explanation in our inheritance chapter of java tutorial. Click here to learn in depth



Please Share this page
Views : 153
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!