Preparing for Java and Spring Boot Interview?

Join my Newsletter, its FREE

Top 10 Tough Core Java Interview Questions Answers for Programmers

tough core Java interviews questions and answers
What is a tough core java interview question? Why do people look for tough Java questions before going for an interview? well, I don't think I need to answer these tough questions because it's pretty natural to prepare for tough questions even if you are not expecting tough questions from core Java. If you are prepared for the tough and tricky Java interview question then you feel more confident and answer other Java interview questions with confidence. 

On the other hand, if you are not prepared for tough and tricky core Java questions then seeing them on Java interview or written test may surprise you. But the definition of tough core Java questions is not universal, the same Java question which is easy for one programmer might be tough for other Java programmers.

That's why it's best to prepare your own list of tough interview questions before appearing on any Java job interview. In this article, I am going to share you with my Top 10 tough core Java interview questions and answers, which may help you in the Java interview.

10 tough Java interview question and answer

Here is my list of 10 tough or tricky Java interview questions. These questions are mostly from Core Java and I have not included J2EE questions. As I said you may know answers to these tough Java questions or you may not even find it tough enough to challenge your Java knowledge but once upon a time these were asked in various Java interviews and many programmers including my friends and colleagues find them tough to answer.

1. Why wait and notify is declared in Object class instead of Thread? 
Another tough java question, how can you answer this question if you are not designed Java programming language. anyway, some common sense and deep knowledge of Java programming help to answer such tough core java interview questions. See this blog post to learn  Why to wait and notify is declared in Object class and not in Thread.

Top 10 Tough Core Java Interview Questions Answers for Programmers

2. Why are multiple inheritances not supported in Java? 
I found this core Java question really tough to answer because your answer may not satisfy the Interviewer, in most cases Interviewer is looking for specific points and if you can bring them, they would be happy. The key to answering this kind of tough question in Java is to prepare the topic well to accommodate any follow-ups. See Why multiple inheritances are not supported in Java for an answer to this tough Java question.

3. Why does Java not support operator overloading? 
One more similar category of tough Java questions. C++ supports operator overloading than why not Java? this is the argument Interviewer will give to you and sometimes even say that the + operator is overloaded in Java for String concatenation, Don't be fooled by such arguments. See  Why to support operator overloading is not supported in Java for a detailed answer to this tricky Java question.

4. Why is String immutable in Java? 
My favorite Java interview question is tough, tricky but at the same time very useful as well. Some interviewer also asks this question as to Why String is final in Java. look at this post for some points which make sense on Why String is final or immutable in Java

Java interview questions for 5 to 10 years experienced

5. Why char array is preferred to store passwords than a String in Java? 
Another tricky Java question which is based on String and believes me there is only a few Java programmer which can answer this question correctly. This is a really tough core Java interview question and again the solid knowledge of String is required to answer this. see Why char array is better than String for storing the password in Java to find out the answer to this tough Java question.

6. How to create a thread-safe singleton in Java using double-checked locking?
This Java question is also asked as What is a thread-safe singleton and how do you write it. Well, Singleton was created with double-checked locking before Java 5 was a broker and it's possible to have multiple instances of Singleton if multiple threads try to create an instance of Singleton at the same time. 

From Java 5 onwards it's easy to create thread-safe Singleton using Enum. but if the interviewer persists with double-checked locking then you have to write that code for them. remember to use a volatile variable.  See 10 Java singleton interview questions for more details on this topic.

7. Write a Java program to create a deadlock in Java and fix it?
One of the classical but tough core Java interview questions and you are likely to fail if you have not been involved in the coding of multi-threaded concurrent Java applications. See  how to create and prevent deadlock in Java for the complete answer to this tough core Java interview question

difficult java interview questions for experienced

8. What happens if your Serializable class contains a member which is not serializable? How do you fix it? 
Any attempt to Serialize that class will fail with NotSerializableException, but this can be easily solved by making that variable transient for static in Java. See Top 10 Serialization interview question answers in Java for more details.

9. Why wait and notify called from a synchronized method in Java? 
Another tough core Java question for the wait and notify. They are called from synchronized method or synchronized block because wait and modify need a monitor on Object on which wait or notify-get called. See  Why to wait and notify require synchronized context for a complete answer to this tough and tricky Java multi-threading question.

10. Can you override the static method in Java? if I create the same method in the subclass is it a compile-time error?
No, you can not override the static method in Java but it's not a compile-time error to declare the exact same method in a subclass, That is called method hiding in Java. You can further see  Can you override the static method in Java for a complete answer to this tough Java interview question.

These were my list of tough core Java interview questions and answers. Some of the Java questions don't look that tough for an experienced programmer but they are really tricky to answer for intermediate and beginners in Java. by the way, if you have faced any tough Java questions in an interview then please share them with us.

Related Interview Questions from Java67 blog

Thanks for reading this article so far. If you like these Java interview questions or have seen them on your telephonic round of interviews, then please share this post with your friends and colleagues on Facebook, Twitter, Email, etc. If you have any questions or feedback, please drop a note.

All the best Guys


  1. nice blog... self explanatory... :)

  2. Very very good compilation of all good questions.. Thanks. Wish me luck for my interviews ..

  3. Most of the tough questions I faced on programming interviews are from Data Structure and algorithm. Only difficulty arise on complex Java topics like classloaders, socket programming and multithreading. Since, no body ask question from Swing or AWT, those are useless topics to prepare for Java interviews.

  4. I conduct a lot of Java interviews, and I wouldn't ask more than one or two of these questions. If someone can't explain why Java doesn't use operator overloading, maybe the candidate never used C++ and doesn't have a clue what it is. How many people use serialization? I have, but not often. We've got a couple sharp guys who have never used it, but if they had to, they'd have it figured out in no time. The important questions are about software structure, and class design. A person can write perfectly functioning software with a terrible design, and that is the danger. For example if you asked me "How do you create a thread-safe singleton in Java using double-checked locking?" I'd say, "I'm not going to create a singleton. Using global state is a bad design."

    1. You nailed it. Testing abilities which is core to programming and software development should be focus of any interview, be it Java, C++ or anything. If a guy had experience in software development, class design, concurrency, data structures and algorithms, he is going to add value in team. Knowing some bits and pieces of Java questions is much easier than to develop skills needed for good software development and maintenance.

    2. Yes I too believe interviewers should focus more on candidates ability to design , logic/Algo used for the design and the approach for coding it out. A candidate should have good learning acumen as well because given any new laguage, tool or FW he/she should start using their fundamentals to develop good software products.

    3. Completely agree. A lot of time on interview people ask questions on remebering. Why do I need to remember thing, however I am capable of solving porblems and quickly figured thibgs that I never used before. So if somebody asked me questions on remebering I even do not want to work with them.

  5. Good collection!! Keep improving .. Add some tough questions from Collections too.

  6. Good Work Javin Paul
    Liked the Explanation ...... alot
    looking more ......

  7. I agree with the Anonymous here, I have around 8 years of experience. I was rejected in couple of interviews where Interviewer went deep in frameworks or how this works internally in JVM or that works, which I found very wired, frameworks change quickly. In service industry it is demand vs supply and at the end a happy customer is required. I too take interview for my company and all I look in a candidate is how sharp the candidate is in his skills and how quickly he/she can solve a problem or get around it. I have seen people who are very good at answering above questions struggle a lot when actual work is required while a smart person learn things very quickly and gets the job done.

    The point I am trying to make here is if you are hiring a driver test his driving skills not his knowledge on how engine works or how the engine components are designed. I remember one of my colleague went for an interview with a company where he was asked to design his own hashmap and after selection all he is doing now is fixing bugs which he gets one or 2 in a week, and I was wondering how many candidates would have been rejected because of that question.

  8. Hi,
    Can anyone please tell me the solution for the below question:
    I have a super class named A,and few sub classes named B,C.The both sub classes B and C extends A.
    I want to add the super class object in the collection(like arraylist) not sub class objects.
    I means the collection should allow only super class object not sub class object.

  9. Great questions but preparing just 15 20 questions won't be enough. See this list of Java interview questions for through preparation. It convers advanced topics like Concurrency, JVM internals, GC tuning, NIO and design patterns.

  10. Interviews are so boring anyway...

  11. If candidate does not answer few questions, it does not mean that he/she does not know anything. It depends on the domain and the concepts the candidate is using in his/her current project. As we know every technology is vast, depending on the scenarios and domain each individual uses different technique. So I feel it is good if candidate knows in and out of some concepts what is being used.

  12. Why you made so much links make single page doc ... it will be very helpful

  13. That's Great Sir...!!!
    Most of the question which you have mentioned asked from me During interview. And the grace of Almighty Allah i feel lucky to answer of them Correctly.

    1. Congratulations for your Success @Anonymous. Glad that these interview questions help you to do well on your Interview.

  14. Nice Article....!!!
    Looking for more.... :)

  15. The questions are great.. But the design is stupid. Why dont you give specific answer below the question itself instead of giving link... Grow up buddy..


Feel free to comment, ask questions if you have any doubt.