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.

TopicWhat it checksQuestions per test
Java basicsPrimitives, operators, final, switch, arrays3
Object-oriented programmingInheritance, interfaces, overloading vs overriding, access modifiers3
StringsImmutability, equals vs ==, StringBuilder2
CollectionsList, Set, Map, HashMap, equals and hashCode2
ExceptionsChecked vs unchecked, finally, try-with-resources2
Java 8+ featuresLambdas, functional interfaces, streams, Optional1
JVM, memory & threadsJVM, JDK vs JRE, heap and stack, garbage collection, synchronized2

How to read your score

ScoreWhat 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

More free interview questions tests

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
Dhaivat Ajwaliya

About the author

Dhaivat Ajwaliya

Dhaivat has 16+ years of experience in the IT industry, working on AI and cloud technologies, project delivery, and engineering leadership. He has interviewed and mentored many interns, wrote The Lost Intern, and runs the non-commercial Career Impact Initiative, mentoring students for free.