Sitemap
Javarevisited

A humble place to learn Java and Programming better.

Featured

Top 140 Java Interview Questions Answers for 3 to 5 Years Experienced Programmers

Sent as aNewsletter
43 min readJun 23, 2025

--

Top 140 Java Interview Questions Answers for 3 to 5 Years Experienced Programmers

22 Essential Topics for Java Developer Interviews

140 Java Interview Questions Answers for 3 to 5 Years Experienced Programmers

1. Multithreading, Concurrency and Thread basics Questions

// The standard idiom for using the wait method
synchronized (obj) {
while (condition does not hold)
obj.wait(); // (Releases lock, and reacquires on wakeup)
... // Perform action appropriate to condition
}

2. Date types and Basic Java Interview Questions

byte a = 127;
byte b = 127;
b = a + b; // error : cannot convert from int to byte
b += a; // ok

3. JVM Internals and Garbage Collection Interview Questions

4. Basic Java concepts Interview Questions

5. Java Collections Framework Interview Questions

// from ArrayList.java JDK 1.7
private static final int DEFAULT_CAPACITY = 10;
//from HashMap.java JDK 7
static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; // aka 16

6. Java IO and NIO Interview questions

// Creating a non-direct ByteBuffer with a specified capacity
int capacity = 1024;
ByteBuffer buffer = ByteBuffer.allocate(capacity);
// Creating a direct ByteBuffer with a specified capacity
ByteBuffer directBuffer = ByteBuffer.allocateDirect(capacity);

7. Java Best Practices Interview question

8. Date, Time and Calendar Interview questions in Java

9. Unit testing JUnit Interview questions

10. Programming and Coding Questions for Java Interviews

11. Java Interview questions from OOP and Design Patterns

12. Miscellaneous Java Interview Questions Answers

throw new IllegalArgumentException("size must be multiple of 2")

13. Modern Java Interview Questions (records, sealed classes, virtual threads)

String result = switch (day) {
case MONDAY, FRIDAY -> "Weekend coming";
case TUESDAY -> "Taco day";
default -> "Just another day";
};
if (obj instanceof String s) {
System.out.println(s.toUpperCase());
}
public sealed class Shape permits Circle, Rectangle {}
String query = """
SELECT *
FROM users
WHERE status = 'ACTIVE';
""";

--

--

Javarevisited
Javarevisited

Published in Javarevisited

A humble place to learn Java and Programming better.

javinpaul
javinpaul

Written by javinpaul

I am Java programmer, blogger, working on Java, J2EE, UNIX, FIX Protocol. I share Java tips on http://javarevisited.blogspot.com and http://java67.com

No responses yet