Showing posts with label java interview. Show all posts
Showing posts with label java interview. Show all posts

Sunday, December 16, 2018

Java Interview Preparation article : OOPS concept

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.

Sunday, December 9, 2018

Java Interview Preparation article :1

Time and again I get requests to write on preparation for interviews in Java. So I am planning to write series of post targeting interview preparation.
To start if the interview is for service based company the key is breadth. And for product based company its the depth. The exception for (breadth/depth) is directly proportional to years of experience.
Another point I want to make entry level roles (0 years to 5 years) you need to do well in java interview rounds to get selected. For more experience this round is kind of elimination round.

Topics in core Java

  1. OOPs concept
  2. Java key word, more priority to the latest released key words.
  3. Inheritance, interface, marker interface, abstract class and is a has a relationship  
  4. Enums
  5. The details about java.lang.Object 
  6. Strings 
  7. Exception handling
  8. Collections 
  9. Threads and Concurrent Package
  10. Design Pattern
All these topics will cover good amount of ground. There might be some here and there question about garbage collection, jvm architecture, java memory management etc. Those questions were more relevant when java was dominant. Now we see the increase popularity of python, Scala so its kind of ok to focus energy in understanding other topics.

Once you get thorough these topic next stage is Java in web development, which we will see in another post.