Java technical interview questions

Previous
Next

In this post, we will see top Java technical interview asked in the Core Java interview.I have covered a lot of interview question on Java programming.
Here is list of other java interview question you might find useful.

Here is the list of top 10 Java technical interview questions.

1 How HashMap works in java?

This is most asked interview question in java interview. You need to have understanding of internal working of HashMap to answer this questions.

You can refer How HashMap works in java for details.

2 Which methods you should implement for key Object in HashMap?

You need to implement Hashcode and equals method for Key object in HashMap.

You can refer Hashcode and equals method for details.

3. Guess the output of below program.

Main class

4. Guess the output of below code.

What will be output of above program.

5. What are differences between Comparator and Comparable?

Comparable and Comparator are used to sort list of object.

Please refer to the difference between Comparator and Comparable for details.

6. What is difference between Error and Exception?

Both java.lang.Error and java.lang.Exception classes are sub classes of java.lang.Throwable class.
You can not recover from Error but you can recover from Exception from using try catch block.
Examples for Errors are: java.lang.StackOverflowError, java.lang.OutOfMemoryError
Examples of Excpetions are: IOException, NullPointerException.

7. What is ClassLoader in java?

ClassLoader is the program that loads byte code class to memory whenever you want to need it.

8. What are types of ClassLoader in java?

There are three types of Class Loader in java.

Bootstrap class loader: It loads classes related to Java platform.
Extension class loader: Here the classes which will use Java extension mechanism will be loaded. These classes will reside in extensions directory as .jar files.
Application class loader: these classes are defined by users. These classes will be found by using class path variable.

9. Are you aware of Singleton design pattern? Can you create a Singleton class?

Singleton means you can create only one instance of that class.You can create a static method which will give you singleton object and you can make constructor private to restrict more than one object for below class.
This is a very basic version of Singleton class and there are various concepts such as Serialization,multithreading which can break below Singleton class.

10. What is the difference between Statement and PreparedStatement?

Statement : is used to execute normal SQL queries.You can not pass parameters to Statement.
PreparedStatement : PreparedStatement is used to execute dynamic or parameterized queries.PreparedStatement extends Statement.If you are going to execute queries multiple queries then you should use PreparedStatement as PreparedStatement are precompiled and query plan is executed only once no matter how many time you will execute the query.

That’s all about Java technical Interview questions.

Previous
Next

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.

Add Comment

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.
You can like our facebook page Java2blog