This is continuation of Java Interview Preparation . Here we will see OOPS concept. Encapsulation, Abstraction, Inheritance and Polymorphism are the basic pillars of object oriented programming language. And how Java adhere to these principle is crucial. These topics are covered in almost all the java book or can be found over internet also. Here is one link.
While answering abstraction and encapsulation it may sound overlapping. My explanation for encapsulation is, inside class all the members would be private to prohibit direct access of them from out side of the class. The public methods are for carry out various operation. And the caller of those methods need not know the internal implementation, only the meaning of required arguments to invoke the method is sufficient to achieve the goal. This is called abstraction.
In Java inheritance is achieved by "extends" and "implements" key word. It means either by extending another class or implementing a interface.
Child class is always a super set of parent class. Its also known as "is a" relation ship. There cloud be many questions under this topic. How the objects get created, the order of invocation of constructors. How a parent class reference can hold a child class object etc. Why java doesn't allow multiple inheritance. What are marker interface ? Several questions fall under this.
This is an nice article to understand polymorphism. There are two aspects of this compile time polymorphism and run time polymorphism.
https://www.geeksforgeeks.org/dynamic-method-dispatch-runtime-polymorphism-java/
https://www.dineshonjava.com/compile-time-polymorphism-in-java/
There could be other question like difference between aggregation vs composition.
"is a" vs "has a"
How can you achieve multiple inheritance in java ? ( By interface)
But I feel the major three concepts will put you in good spot to attempt the question around it.
While answering abstraction and encapsulation it may sound overlapping. My explanation for encapsulation is, inside class all the members would be private to prohibit direct access of them from out side of the class. The public methods are for carry out various operation. And the caller of those methods need not know the internal implementation, only the meaning of required arguments to invoke the method is sufficient to achieve the goal. This is called abstraction.
In Java inheritance is achieved by "extends" and "implements" key word. It means either by extending another class or implementing a interface.
Child class is always a super set of parent class. Its also known as "is a" relation ship. There cloud be many questions under this topic. How the objects get created, the order of invocation of constructors. How a parent class reference can hold a child class object etc. Why java doesn't allow multiple inheritance. What are marker interface ? Several questions fall under this.
This is an nice article to understand polymorphism. There are two aspects of this compile time polymorphism and run time polymorphism.
https://www.geeksforgeeks.org/dynamic-method-dispatch-runtime-polymorphism-java/
https://www.dineshonjava.com/compile-time-polymorphism-in-java/
There could be other question like difference between aggregation vs composition.
"is a" vs "has a"
How can you achieve multiple inheritance in java ? ( By interface)
But I feel the major three concepts will put you in good spot to attempt the question around it.