Assessment
Java Assessment Test
Java assessment test for hiring: OOP, collections, concurrency, streams and JVM basics, with sample questions by level, a scoring rubric and red flags.

The short answer
A java assessment test for hiring typically runs 35-50 minutes, short coding problems, code output prediction, debugging exercises, class design problems and scenario-based architecture questions, at 3 difficulty levels. Give it after the first screen and before interviews, and score it on the areas below, fixed before you see any answers, so every candidate is judged the same way.
- Core Java syntax, data types and control flow
- Object-oriented programming principles (encapsulation, inheritance, polymorphism, abstraction)
- Collections framework (List, Set, Map implementations and trade-offs)
- equals and hashCode contracts, immutability and records
Cohesyve tests Java inside an AI job simulation of the role, after finding and contacting candidates. 14-day free trial for 10 candidates, not charged until it ends.
About to take a Java test? Practise it free →A Java assessment test, or Java coding test, checks whether a candidate can write and reason about production Java: object-oriented design, the collections framework, exceptions, generics, lambdas and streams, concurrency, and enough JVM knowledge to diagnose memory and performance problems. Java is widely used for enterprise backends, Android apps and JVM data tools, so the strongest tests use problems from the role, include a debugging or concurrency task, and are scored on correctness, design and the candidate's explanation.
Format
What it measures
- Core Java syntax, data types and control flow
- Object-oriented programming principles (encapsulation, inheritance, polymorphism, abstraction)
- Collections framework (List, Set, Map implementations and trade-offs)
- equals and hashCode contracts, immutability and records
- Exception handling and error management patterns
- Multithreading, concurrency and synchronisation
- Generics, lambdas and the Stream API
- JVM memory model and garbage collection fundamentals
Test Java on the real work
Cohesyve builds an AI job simulation from your job description that covers Java as the role uses it, finds and contacts candidates, and returns a ranked shortlist. 14-day free trial for 10 candidates, not charged until it ends.
Who takes it
Topics covered
Core Language
- Primitive vs. reference types
- String immutability and the string pool
- Access modifiers and encapsulation
- Static vs. instance members
- Autoboxing and unboxing
Collections & Generics
- ArrayList vs. LinkedList performance
- HashMap internals and collision handling
- TreeMap vs. HashMap vs. LinkedHashMap
- Generics and type erasure
- Comparable vs. Comparator
Concurrency
- Thread lifecycle and management
- synchronized, volatile and atomics
- ExecutorService and thread pools
- Concurrent collections
- Deadlock prevention strategies
Modern Java & Design
- Lambda expressions and functional interfaces
- Stream API operations and collectors
- Optional for return values
- Records and sealed classes
- SOLID principles in practice
Sample questions
Why can new String("a") == "a" evaluate to false, and what should you use to compare strings?
JuniorLook for == compares references, not contents; explains the string pool and uses equals() (or Objects.equals for possible nulls).
You override equals() on an Employee class, but a HashSet still holds two equal employees. What did you miss?
JuniorLook for hashCode() must be overridden consistently with equals(); uses the same fields; mentions that records generate both.
Ten threads each run count++ 1,000 times on a shared int field. The final value is often below 10,000. Why, and give two fixes.
Mid-LevelLook for count++ is a read-modify-write, not atomic; fixes with AtomicInteger (or LongAdder) or a synchronized block; knows volatile alone gives visibility, not atomicity.
Using the Stream API, group a List<Order> by customer and sum the amounts. What type would you use for money?
Mid-LevelLook for Collectors.groupingBy with a reducing or summing collector; uses BigDecimal rather than double for currency and explains rounding.
findUser(id) returns null when no user exists, and callers keep hitting NullPointerException. How would you redesign it?
Mid-LevelLook for Returns Optional<User> (or throws a specific exception where absence is an error); does not use Optional for fields or parameters; keeps the API consistent.
A Java service's heap grows steadily until it fails with OutOfMemoryError after a few days. How do you investigate?
SeniorLook for Enables GC logs, takes heap dumps over time and compares them, looks for growing caches, static collections, listeners and unclosed resources, then reproduces and fixes the leak.
Design a thread-safe cache with expiry for an expensive lookup. What would you build, and what would you use instead of building it?
SeniorLook for ConcurrentHashMap with computeIfAbsent, expiry and size bounds, protection against many threads loading the same key at once, and a mature caching library where appropriate.
Red flags
- Compares strings or boxed numbers with ==
- Catches Exception and ignores it
- Uses double or float for money
- Believes volatile makes count++ thread-safe
- Deep inheritance hierarchies where composition fits
- Cannot explain checked versus unchecked exceptions
Scoring rubric
| Criterion | Weight | What strong looks like |
|---|---|---|
| Correctness | 30% | Working code that handles nulls, empty collections and edge cases. |
| Language and JVM understanding | 20% | Explains equality, immutability, generics and memory behaviour accurately. |
| Concurrency reasoning | 20% | Identifies races and picks the right tool to fix them. |
| Design and API quality | 15% | Clear classes and method contracts that are hard to misuse. |
| Communication | 15% | Explains trade-offs plainly and states assumptions. |
Why it is used
For employers
- Validate real Java engineering skill before allocating senior engineer interview time
- Assess understanding of concurrency and performance, which are critical for enterprise systems
- Each candidate gets a different variant, so answers cannot be passed around
- Receive detailed competency breakdowns to guide technical interviews
- Standardise Java skill evaluation across distributed hiring teams
For candidates
- Demonstrate enterprise-grade Java knowledge through practical scenarios
- Show practical Java skill in one sitting instead of a multi-day take-home project
- Showcase understanding of modern Java features that many resumes cannot convey
- Receive a fair, role-appropriate evaluation regardless of educational background
Common questions
What is a Java coding test?
A Java coding test is a timed exercise where a candidate writes, debugs or explains Java code for problems set by the employer. It checks practical skill with collections, object-oriented design, exceptions and concurrency before interviews.
How long should a Java assessment be?
For screening, 35 to 50 minutes covers two short coding problems, one debugging or output-prediction task and a design question. Senior roles can add a longer design discussion in the interview loop.
Which Java version does the assessment focus on?
Modern Java from Java 8 onwards, including features standard in current codebases such as lambdas, the Stream API, records and sealed classes. The focus is on practical, production-relevant knowledge rather than version-specific trivia.
Does the test include Spring or Spring Boot questions?
This assessment focuses on core Java language and platform skills. Framework questions can be added when the role relies on Spring; a strong core Java foundation is the baseline.
How does the test evaluate senior-level Java skills?
Senior questions focus on concurrency, memory and performance diagnosis, API design and system trade-offs, like the heap-growth and cache samples above.
How do I prepare for a Java assessment test?
Revise the equals and hashCode contract, collection trade-offs, exception handling, streams and collectors, and basic concurrency with executors and atomics. Practise explaining your code out loud as you write it.
Test Java before the first interview
Cohesyve takes your job description, finds candidates, reaches out to them and tests Java in an AI job simulation of the real work, then returns a ranked shortlist.
1,500+
assessments completed
50%
faster time-to-hire
5 min
from JD to assessment
14-day free trial · 10 candidates · Not charged until the trial ends
About to take a Java test yourself? Practise on an AI job simulation that uses it. 3-day free trial, cancel anytime.
From the blog