Java Interview Questions for 2 to 3 years experience - Answered

Java Interview Questions 2 to 4 years experienced
If you are a Java programmer with 2 to 3 years experience of working in Java and looking for job change then its better to know what is expected from a 2 to 3 years experienced Java programmer in a typical core Java or J2EE interview. Since 2 to 3 years is not a huge experience and you still fall under beginner to intermediate category , its not expected from you to have done profiling, Garbage collection tuning or designing complex Java applications or even creating concurrent Java design pattern. What is expected from a 2 to 4 years experience guy in Java programming is sound knowledge of Java fundamental including OOPS concepts like Abstraction, Encapsulation, Polymorphism, Composition and Inheritance, good knowledge of Java collection API and familiarity with different kinds of collection e.g. List, Set and Map with some familiarity with popular Collection classes e.g. ArrayList, HashMap, Vector and HashSet etc. Fundamental knowledge of Java threading API, wait-notify mechanism and Exception handling in Java is also something Interviewer look in a intermediate Java programmer and of-course some basic programming and coding exercise e.g. finding length of linked List in one pass or reversing String in Java etc. If you manage to prepare these topics well, you are most likely to do well in Java interviews on service based companies e.g. Tech Mahindra, CapeGemini, CTS, Wipro, TCS etc.

In this Java interview question and answer article we will see some popular and tricky Java question asked with 2 to 3 or 4 years experienced Java developers in software developer interviews.

core Java Interview Questions and answers for 2 to 4 years experienced programmerQuestion 1) What is difference between Vector and ArrayList in Java?
Answer : One of the most popular Java question at 2 years experience level which aims to check your knowledge on Java collection API. key point to mention is synchronization and speed, since ArrayList is not synchronized its fast compare to Vector. See Vector vs ArrayList in Java for more difference between both of them.

Question 2) What is difference in LinkedList and ArrayList in Java?
Answer : If you don't get previous Java question then you are likely to get this question at 2 to 3 years experience level Java interview. Unlike synchronization, key point to mention here is underlying data structure. See LinkedList vs ArrayList in Java for detail answer of this java question.

3) What is difference between fail-fast and fail-safe Iterator in Java?
This is relatively new Java question compare to previous ones but increasingly getting popular into 2 to 3 years level Java interviews. key difference here is that fail-fast Iterator throw ConcurrentModificationException while fail-safe doesn't. See fail-safe vs fail-fast Iterator in Java for more differences between two.

4) Difference between throw and throws in Java?
This Java question belongs to Exception handling category which is another popular category for 2 to 4 years experienced Java programmer. Main difference between these two is that one declares exception thrown by a Java method while other is actually used to throw Exception. See Difference between throw and throws in Java for full answer of this Java exception handling question.

5) What is difference between checked and unchecked Exception in Java.
Another java interview question for 2 to 4 years experienced Java programmer from Exception handling. key point to mention here is that checked Exception requires mandatory exception handling code while unchecked doesn't. See  checked vs unchecked Exception in Java for more differences.

6) Write code to print Fibonacci series in Java?
You are bound to expect some coding interview question in Java interview for 2 to 4 years experience. Though Fibonacci series is one of the most classical and popular question not every Java programmer is able to do it correctly in interview, things get more complicated if interviewer ask to do this by using recursion. So better to prepare for approach, See how to write Java program for Fibonacci series using recursion for details and code example.

7) Write Java program to reverse String in Java without using StringBuffer?
Another Java coding interview question asked on 2 ot 4 years experienced Java developer. Many times interviewer specifically mentioned that you can not use StringBuffer because it has reverse() method which makes this taks trivial. So you must know how to do this by using iteration as well as recursion to perform well. Look at Java program to reverse String in Java for full code sample and explanation.

8) What is difference between Runnable and Thread in Java ?
Frequently asked Java interview question on 2 to 4 years experienced level from Threading fundamentals. there are two ways to implement Thread in Java, in fact three e..g extending java.lang.Thread class or implementing java.lang.Runnable or Callable interface. See Thread vs Runnable in Java for exact differences on following each approach.

9) What happens if you don't call wait and notify from synchronized block?
Another common Java interview question from multi-threding and inter thread communication. As I said earlier you must know concept of wait and notify in Java if you have worked for 2 to 3 years in Java. Check why wait and notify needs to call from synchronized block for exact reason to answer this Java question.

10) Write code to solve producer consumer problem in Java.
A good java question in my opinion which is mix of threading, synchronization, inter-thread communication and coding abilities. This particular java question can make any body's list at any day, not just 2 to 4 years experienced programmer. despite being so common it has something on it which confuse average programmer and allow you to differentiate between good and average programmer. See Producer consumer problem solving using BlockingQueue in Java for full code example.

These were 10 frequently asked Core Java interview question for 2 to 3 years experienced Java programmers. If you  want to increase numbers there are lot many questions floating around web for 2 to 3 or 2 to 4 years experienced Java developers but key things it to remember topics e.g. Collection, Exception handling, Coding, Threading and OOPS principles are the main areas from which most of 2 to 3 years experienced Java programmer interview question appear. Just get them right and you can crack any Java interview upto 2 to 4 years experienced Java programmer.

Other Java Interview articles from Java67 Blog


  1. Hi Javin i am working as a java developer in a company and i have 9 months of work ex i am trying to change my company can u tell me what all the interviewer can ask me and i am proficient in core java , jsp ,servlets .Plz do reply

    1. In which company you are currently working

    2. Sun Microsystems

    3. Until you don't have strong reason to change or contract period is over, don't go for it. Stay in one company at least for 2 years, If you change in short time, next company really doubt about your commitment part.

  2. m goin to attend my first experience interview.....what all the interviewer can ask me and i am proficient in core java , jsp ,servletsn anybody help me....specially related to project

  3. I have 2 yrs experience in java . i am searching for the jobs . i have tried using but unable to get any interview call. if anyone can help please ?

  4. Anybody having info regarding java <1 exp job opening..Please let me know at

  5. I am a 2013 passout fresher. But i know all the java/j2ee technologies and also the frameworks.So if any one wants to hire me then contact me -

  6. I have 5 years of java experience in developing web application using Struts & EJB, JSP, Servlet.
    I struggle a lot for job change not able to clear any of the interview still.
    I don't know what is the interviewer's expectation.

  7. @July 30, 2014 Anonymous person don't be disappointed someday you will crack it. Just make some time and read all the articles in this beautiful blog, I was in the same position it really helped me and it would do to you too ;)

  8. Anonymous, I know what you mean. These interview questions are dumb. Anyone who just did a first year course in Java could probably answer those questions. Does that say anything about their performance? No, just means you do well at answering those questions.

  9. ya this is the nice information for 2-3 year exp devlopers

  10. All these questions are for freshers only.

  11. Please Try to Put a Button called Download , so that we can download the Interview Quesions PDFs from that , which helps us a lot in interviews..

  12. am goin to attend my first experience interview.....what all the interviewer can ask me and i am proficient in core java , jsp ,servletsn anybody help me....specially related to project

  13. Hi Guys,

    I am deepa and having 1.9 yrs exp in Android, now working in Noida since last 7 months. Now i want to change my job bcoz i have to learn more but in my current company has limitted work they have small small projects that's why i am searching job in Noida location.... So if anyone wants to hire me please contact to me at

  14. Hi,

    I am having work experience of 2 year in TCS but as a network administrator, but I want to change my domain to JAVA as I am passionate about coding and JAVA, kindly suggest me how I should prepare for interview and what are the things I should study before I go to any interview. I have knowledge of Core Java, JSP, Servlet and also knowledge of different languages but I was confident on these languages before 2 year. Please suggest me how I should start preparation and that should take less time as i am looking for switch asap.

    1. Hello, you can just go though all list of interview questions I have in this blog and Javarevisited, this will give you enough experience and broad your knowledge. They will also help you to familiar with essential Java concepts e.g. multi-threading, collection, GC, JVM internals etc. Once you are comfortable with popular questions, you can start applying. It will take a couple of interviews but slowly you will pick it up and finally get the job you want.

  15. I have 1 and 4 month experience as java developer so please tell me should I switch this?