Preparing for a Java internship or fresher interview? This free Java interview questions test gives you 15 random questions on Java basics, object-oriented programming, strings, collections, exceptions, Java 8 features, and the JVM, and explains every answer. You get a new set of questions every time you take it.
What this Java interview test covers
Every attempt gives you 15 random questions, balanced across 7 topics, with the questions and answer options shuffled, so no two tests are the same.
| Topic | What it checks | Questions per test |
|---|---|---|
| Java basics | Primitives, operators, final, switch, arrays | 3 |
| Object-oriented programming | Inheritance, interfaces, overloading vs overriding, access modifiers | 3 |
| Strings | Immutability, equals vs ==, StringBuilder | 2 |
| Collections | List, Set, Map, HashMap, equals and hashCode | 2 |
| Exceptions | Checked vs unchecked, finally, try-with-resources | 2 |
| Java 8+ features | Lambdas, functional interfaces, streams, Optional | 1 |
| JVM, memory & threads | JVM, JDK vs JRE, heap and stack, garbage collection, synchronized | 2 |
How to read your score
| Score | What it means |
|---|---|
| 12–15 (80%+) | Interview-ready. Your fundamentals are strong. Practise explaining these answers out loud, then start applying. |
| 8–11 (50–79%) | Almost there. A good base with a few gaps. Review your weakest topics and retake the test with new questions. |
| 0–7 (below 50%) | Build the basics. Focus on fundamentals first, using the explanations in your results, and try again in a week. |
Sample Java interview questions for freshers (with answers)
Here are five questions of the kind the test asks, with answers and explanations.
1. How should you compare the text of two strings?
- A.
a == b - B.
a.equals(b) - C.
a.compare(b) == true - D.
a = b
Answer: B. == compares references; equals() compares content.
2. Which statement is true in Java?
- A. A class can implement many interfaces but extend only one class
- B. A class can extend several classes
- C. A class must implement at least one interface
- D. An interface can extend only one interface
Answer: A. Java supports single class inheritance and multiple interface implementation.
3. Which collection does not allow duplicate elements?
- A.
ArrayList - B.
Set - C.
LinkedList - D.
List
Answer: B. A Set stores unique elements; a List allows duplicates and keeps order.
4. What is the difference between checked and unchecked exceptions?
- A. There is no difference
- B. Unchecked exceptions must be declared
- C. Checked exceptions must be handled or declared; unchecked ones need not be
- D. Checked exceptions happen only at runtime
Answer: C. IOException is checked; NullPointerException (a RuntimeException) is unchecked.
5. What does list.stream().filter(n -> n > 2).count() return for [1, 2, 3, 4]?
- A. 7
- B. 4
- C. 3
- D. 2
Answer: D. Only 3 and 4 pass the filter.
Ready to test yourself?
Take the free Java interview questions test now: 15 random questions, about 10 minutes, with an explanation for every answer.
How to prepare for a Java internship interview
- OOP and collections first: they are the most common Java interview topics for freshers. The technical interview questions guide lists more.
- Build one complete project: a Spring Boot REST API with a database is ideal. Be ready to explain it end to end; see how to explain your college project.
- Know the classic comparisons: `==` vs `equals()`, `ArrayList` vs `LinkedList`, abstract class vs interface, and checked vs unchecked exceptions.
- Practise coding rounds: many companies test Java with timed problems. Read how to prepare for online coding tests.
- Check your overall readiness with the free IT Internship Readiness Test.
More free interview questions tests
- .NET interview questions test: C#, OOP, LINQ, async and ASP.NET Core
- Python interview questions test: lists, dictionaries, functions, OOP and generators
- SQL interview questions test: joins, GROUP BY, keys, subqueries and transactions
- React interview questions test: JSX, props, state, hooks and rendering
- Angular interview questions test: components, data binding, services, routing and RxJS
- Azure interview questions test: cloud concepts, compute, storage, networking and security
- DevOps interview questions test: Git, Linux, CI/CD, Docker and Kubernetes
See all tests and which ones fit your target role on the free internship tests page.
Frequently asked questions
Is this Java interview test free?
Yes. The test is completely free, needs no login, and does not ask for any personal details. Your best score is saved only in your own browser.
How many questions are in the Java test?
Each attempt has 15 random multiple-choice questions, balanced across seven topics. The questions and answer options are shuffled, so every retake gives you a new test.
What level is this Java test?
It is designed for freshers and internship candidates. It checks the Java fundamentals interviewers commonly ask about, not advanced or certification-level topics.
Which version of Java does the test cover?
The questions cover core Java concepts that apply to current versions such as Java 17 and 21, including Java 8 features like lambdas and streams.
Does a high score guarantee an internship?
No. A high score shows strong fundamentals, but interviews also check your projects, problem solving, and communication. Use your result to decide what to study next.
Your next step
Scored well? Learn what happens in each internship interview round, from the online test to the HR interview.
Read the interview guide