Java skill check
Check how well you read and reason about Java: collections, generics, exceptions, streams, and the object model, plus short snippets where you predict the output or spot the bug.
15
Questions
14 min
Timer can't pause
Multiple choice
Java 21
Choose a level
Question type
Topics
- Types and operators
- Strings
- Collections
- OOP and interfaces
- Generics
- Exceptions
- Streams and lambdas
- Concurrency
Do
Use scratch paper or a notepad to work things out. Skip a question and come back to it later.
Don't
Run the code or look up answers during the check. Open the check in more than one tab or window.
Easy · Mixed · 15 questions · 14 min
By starting, you agree to the Terms and Privacy Policy.
Practice checks each answer as you go, with an explanation. The exam is checked when you submit; 9 of 15 passes and earns a certificate.
Checking your levels…
Certificates come from the certified exam: pass with 9 of 15 while signed in. View a sample certificate.
Sample Java questions with answers
These are never used in a check, so seeing their answers here won't give anything away.
Question 1 · Easy · Types and operators
Which statement correctly describes the behavior of the == operator when comparing two reference variables in Java?- A.It converts both objects into their string representations and compares those values.
- B.It evaluates to true only if both variables refer to the exact same object in memory.
- C.It compares the logical content of both objects by automatically delegating to their equals() method.
- D.It evaluates to true whenever both objects have identical field values, even if they are distinct instances.
Show answer
B. It evaluates to true only if both variables refer to the exact same object in memory.
For reference types, == checks reference identity, evaluating to true only when both operands point to the exact same memory address.Question 2 · Easy · Strings
Why are String objects considered immutable in Java?- A.All String instances are automatically stored in the native stack memory rather than the heap.
- B.They can only be constructed using string literals, not via constructors.
- C.Their internal character sequences cannot be modified after the String object is instantiated.
- D.A String variable can never be reassigned to point to another String instance.
Show answer
C. Their internal character sequences cannot be modified after the String object is instantiated.
String immutability means that once a String instance is created, the character sequence it holds cannot be modified; any operation that appears to modify it returns a new String instance.Question 3 · Moderate · Collections
What is the behavior of List.of("a", "b", null)?- A.It throws a NullPointerException immediately when constructing the list.
- B.It ignores the null element and returns a list containing only "a" and "b".
- C.It throws an IllegalArgumentException because null references are unsupported.
- D.It returns an immutable list containing two strings and one null element.
Show answer
A. It throws a NullPointerException immediately when constructing the list.
The unmodifiable collection factory methods introduced in Java 9 (List.of, Set.of, Map.of) explicitly disallow null elements and throw NullPointerException if any element is null.Question 4 · Advanced · OOP and interfaces
In Java 21, what occurs at compile-time if a class implements two interfaces that both declare a default method with identical signatures, and the class does not provide its own implementation?- A.The compiler emits an error due to unrelated defaults being inherited from multiple interfaces.
- B.The class compiles successfully, but calling the method at runtime throws an
IncompatibleClassChangeError. - C.The compiler marks the method as abstract, forcing any concrete subclass to provide an implementation.
- D.The compiler selects the method from the interface listed first in the
implementsclause.
Show answer
A. The compiler emits an error due to unrelated defaults being inherited from multiple interfaces.
If a class inherits more than one default method with an override-equivalent signature from unrelated interfaces, the compiler issues a compilation error unless the implementing class explicitly overrides the method to resolve the conflict.
How scoring and certificates work
- Each check has 15 multiple-choice questions with one correct answer, and one timer for the whole check. A question you leave unanswered scores nothing.
- Practice is free without an account and shows whether each answer is right as you go, with an explanation.
- The certified exam is scored when you submit. 60% passes, which is 9 of 15. Easy unlocks Moderate, and Moderate unlocks Advanced.
- Passing the exam while signed in earns a free certificate, valid for one year, with its own verification page. See a sample certificate.