Java technical interview questions

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.

Related Posts

  • 22 May

    Java interview questions

    I have written a lot of java interview questions and this is index posts for all java interview questions. I will keep adding more interview questions to this post. Core Java Core java interview questions This list includes top 50 core java interview questions. Whether you are fresher or experienced programmer, this interview questions will […]

  • 09 November

    SOLID Principles in Java

    In this post, we will see 5 SOLID Principles in Java. Robert C. Martin gave five objected oriented design principles, and the acronym S.O.L.I.D is used for it. Each letter of this acronym talks about principles in Java. When you use all the principles of S.O.L.I.D in a combined manner, it becomes easier for you […]

  • 08 November

    Java interview questions for 2 years experience

    In this post, we are going to see Java interview questions for 2 to 3 years experienced. These are the most asked interview questions for freshers(0-3 years experienced). This question list will help you to crack java interview. I have already shared detailed answer over here before, you might find it helpful as well. I […]

  • 08 November

    Java interview questions for 5 years experience

    In this post, we will see Java interview questions for 5 to 6 years experience. When you have 5 years of experience as java developer, you need to have a good understanding of collections, multithreading concepts. If you are looking for the below queries then this post will help you as well. Java interview questions […]

  • 06 August

    Top 15 Spring Boot Interview questions

    In this post, we will see top 15 Spring Boot interview questions with answers.If you want to read more about Spring boot, you can go through Spring boot tutorial. If you are looking for below queries then this post will help you as well. Spring boot interview questions for 3 years experience Spring boot interview […]

  • 10 June

    Java Interview Programs for Freshers

    In this tutorial, we will see Java interview programs for freshers. This interview programs will help freshers to crack Java interview. Here is the list of Top 10 Java interview Programs for Freshers. Question 1: Check if number is odd or even? Answer: It is a very basic question. You need to check remainder value […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.