Let's learn java programming language with easy steps. This Java tutorial provides you complete knowledge about java technology.

Monday 21 August 2017

OOPS Concepts in Java Interview Questions

Java OOPs Interview Questions

OOPS Interview Questions In Java

Now, Here we will see some most important java oops interview questions and answers. Here we will discuss all the concepts of object-oriented programming system in this oops interview questions in java.

So let's start oops concepts interview questions.


(1) What is OOPS in Java?

The object-oriented programming system(oops) is a methodology which provides us certain concepts. By using these concepts we can easily design our application with related to the real-world entity.

(2) What are some core concepts of OOPS in java?

There are some different core concepts of oops and these are 

  • Class
  • Object
  • Polymorphism
  • Inheritance
  • Encapsulation
  • Aggreagation
  • Composition
  • Association
  • Abstraction

What is class in Java?

A class is a blueprint or template of an object in java which can have field, constructors, methods, objects. The class is a logical entity.

What is an object?

An object is an instance of a class and it is dynamic memory allocation of class. An entity that has properties(state) and behavior is known as object e.g fan, pen, laptop, mobile, etc.


What is are the characteristics of the object?

1) State

Instance variables(i.e data member) is known as object state.

2) Behavior

An instance method is known as object behavior.

3) Identity

An object identity is implemented via unique ID. This unique id is internally used by JVM to identify each object uniquely. Identity is the hashcode of an object and it is a 32-bit integer number.


What is Polymorphism?

In simple word, Polymorphism means one name many forms e.g A child in home behave(work) like a son and in school behave(work) like a student so there is one name child but producing different-different behaviors in different-different circumstances.

Types of Polymorphism?

There are 2 types of polymorphism.
  • Compile-time or Static polymorphism.
  • Run-time or Dynamic polymorphism.

What is Method Overloading?

Method overloading is also known as compile-time polymorphism in java. Method overloading, whenever we have more than one method with the same name but the different number of parameters or the different type of parameter in the same class is known as method overloading.


What is Method Overriding?

Method overriding is also known as runtime polymorphism in java. To achieve method overriding there must be a parent-child relationship(inheritance) i.e Is-a relationship. Whenever we have same name method in both parent and child class with the same number of parameters and types is known as method overriding.


What is inheritance?

Inheritance means re-usability and it is basically used to achieve runtime polymorphism or dynamic binding in java. In this concept, there is parent-child relationship i.e Is-a relationship and child can inherit or reuse all the methods and properties of its parent class by using "extends" keyword.


Types of Inheritance?

  1. Single Level Inheritance
  2. Multilevel Inheritance
  3. Multiple Inheritance
  4. Heirarchical Inheritance
  5. Hybrid Inheritance

Does Java Support Multiple Inheritance?

Java does not support multiple inheritance through the class but it is possible through the interface.

What is Abstraction in Java?

Abstraction is also an object-oriented feature of java which shows only functionality or useful data to the user and hides internal working or internal implementation details to the user.

for example: Suppose you driving a car and you using all the functions of a car but you don't know how internally this function works.


How to Achieve Abstraction in Java?

There are two ways you can achieve abstraction and these are

  1. Abstract class(0 to 100%)
  2. Interface(100%) 

What is Encapsulation?

Encapsulation is a process of wrapping or combining the data and function into a single unit. You can use access modifiers for variables so other classes may not access it directly but it can be accessed only through public methods of the class. By using private variables you can create fully encapsulated class.


Difference Between Abstraction and Encapsulation?

Abstraction is a process which shows the functionality to the user and hides its implementation details whereas Encapsulation provides a barrier to access of data and methods.

What is Aggregation?

An aggregation is a special form of association. When one object contains another object is called aggregation in java. An aggregation represents HAS-A relationship.

For example:

class Student
{
int rollno;
String name;
Address address;//contains another object like street, city, country.


What is composition?

Composition is a special form of aggregation. If the object contains another object and contained object cannot exist without container object is known as composition.

For example:

Bus has an engine but without a bus engine cannot exist.


What is Association?

Association is a relationship between two objects. It define association between object such as one-to-one, one-to-many, many-to-one, many-to-many.

What is Static Binding?

Static binding is also known as early binding and it resolved at compile-time. Method overloading is the best example of static binding.

What is Dynamic Binding?

Dynaic binding is also known as late binding and it resolved at run-time. Method overriding is the best example of dynamic binding.

Here we have learned 4 major principles of object-oriented programming such as polymorphism, inheritance, encapsulation, abstraction, etc.

Read More:

Java Method Overloading Interview Questions.
Java Constructor Interview Questions.
Java Inheritance Interview Questions.
JSP Interview Questions.

Share:

16 comments:

  1. sir,it is excellent notes

    ReplyDelete
  2. I just loved your article on the beginners guide to starting a blog.If somebody take this blog article seriously
    in their life, he/she can earn his living by doing blogging.Thank you for this article.
    java online training

    ReplyDelete
  3. Get all types of OOPS interview questions now at Technology Crowds.
    Thank you!

    ReplyDelete
  4. pilz give more interview quastion for freshers

    ReplyDelete
  5. you have written an excellent blog.. keep sharing your knowledge...
    Perl Training in Chennai

    ReplyDelete
  6. Nice Bog! Thank you for sharing the valuable information.
    Java Online Training
    Visit us: Java Online Training

    ReplyDelete
  7. It is a great pleasure to read your message. It's full of information I'm looking for and love to post a comment that says "The content of your post is amazing". Excellent work.
    Java Course in Nagpur

    ReplyDelete
  8. I really enjoy the blog article.Much thanks again.
    java training
    java course

    ReplyDelete

Facebook Page Likes

Follow javatutorial95 on twitter

Popular Posts

Translate