PRACTICE TESTTech and coding
Java coding test practice
A free Java coding practice test: Java concepts, what the code prints, finding the bug and choosing a working solution, in the style of employer coding assessments, each answer explained.
- 10 free questions, no account
- Timed like the real test
- Cancel any time
- Free sample
- 10 questions · 30 min
- Question types
- Java concepts, What the code prints, Finding the bug and more
- Full-length mocks
- The real number of questions and time limit
The short answer
A Java coding test is an online assessment some employers use to check how well applicants read, write and debug Java before an interview. There is no single test: each employer chooses a platform and sets its own questions, length and time limit, and many ask you to write code that is checked against test cases. This free practice test has 10 original questions on reading, tracing, debugging and choosing Java code and takes about 30 minutes.
- Free sample
- 10 questions in 30 minutes
- Format
- Set by each employer and platform
- Example (HackerRank Java Basic)
- 6 questions in 1 hour
- Coding questions
- Usually scored automatically against test cases
Try it free
10 questions in 30 minutes, at the real pace. Your score and every answer explained at the end.
Choose your plan
Unlock the full practice
Java test: full-length timed mocks, plus every other test
Start the monthly plan- Full-length timed mocks for this test
- An explanation for every question
- Your score by question type, and your history
- All 93 practice tests included
- Works on phone and laptop
7-day refund if you have taken no more than one full mock. Prices in USD.
What's inside the full practice
Full-length mocks in the real format and timing, each with a full review when you finish.
- FreeFree sample10 questions · 30 min
- Full-length mocksThe real number of questions and time limit
- Every question typeJava concepts, What the code prints, Finding the bug and more
- A full reviewYour score by question type after every mock
- Score historyYour progress across attempts
- Phone or laptopPractice wherever you are
- Java concepts90%
- What the code prints75%
- Finding the bug60%
- Building a solution35%
Work on next: building a solution.
Free sample or full practice
| Feature | Free | Full |
|---|---|---|
| Questions in the real style | ||
| Every answer explained | ||
| Full-length timed mocks | ||
| Score by question type | ||
| Score history across mocks | ||
| All 93 practice tests |
Free study guide
Everything to know about the real test, in short lessons.
What the real test usually looks like
There is no single Java coding test. Each employer chooses a testing platform and then sets its own questions, number of tasks, time limit and allowed languages. Your test invitation is the best guide to yours. Public examples show the range:
- HackerRank. HackerRank lists its Java (Basic) skills test as 6 questions in 1 hour, covering topics like classes (HackerRank). Its help center lists the question types an employer can put in a test, including coding, multiple choice, database, back-end developer, code review and subjective questions, and says employers can add questions from HackerRank's library or write their own (HackerRank Help).
- TestGorilla. TestGorilla's Java coding tests page says most of its coding tests take between 15 and 35 minutes, lists an entry-level algorithms test at 15 minutes, and says candidates read the problem, choose Java from a language menu and write their solution in an online editor (TestGorilla).
Parts commonly reported in employer Java tests:
- Coding tasks: write a method in an online editor, run it against sample inputs, then submit it to be checked against more test cases you may not see.
- Multiple choice: Java concepts such as types, classes, collections and exceptions, what a snippet prints, and which code is correct.
- Debugging or code review: find and fix the problem in code someone else wrote.
- Sometimes more: a SQL question, a framework or back-end project, a take-home assignment, or webcam and screen monitoring during the test.
What our mocks cover. Our full mocks have 20 questions in 60 minutes in four sections: Java concepts (6), what the code prints (6), finding the bug (5) and building a solution (3). All code is Java 17. You can go back, change an answer and flag questions until you submit. Our mocks practice reading, tracing, debugging and choosing code. They do not run code you write. Many real assessments do ask you to write code that runs against hidden test cases; this practice builds the reading, tracing and debugging skills behind that, so add some timed practice in a real editor as well. Our mocks also leave out proctoring, plagiarism checks, video interviews, take-home and project tasks, and any employer pass mark.
Question types with worked examples
One worked example for each section, with the trap most people fall into.
1. Java concepts. What is the difference between an int and an Integer? An int is a primitive value; an Integer is an object that wraps one and can be null. Collections such as List hold Integer, and Java converts between the two automatically. Trap: comparing two Integer objects with ==. It compares references and can be false for equal values; use equals.
2. What the code prints. System.out.println(1 + 2 + "3" + 4 + 5); prints 3345. Java works left to right: 1 + 2 is the number 3, then adding "3" makes the string "33", and from then on every + joins text. Trap: doing all the arithmetic first. Trace one operator at a time and note the type after each step.
3. Finding the bug. A method reads if (status == "done") and never matches, even when the status is "done". The fix is "done".equals(status), which compares the characters and also copes with a null status. Trap: fixing the first line that looks unusual. Trace a tiny input through the code and find the first line where the value goes wrong.
4. Building a solution. You need to count how often each word appears. A HashMap with counts.merge(word, 1, Integer::sum) in a loop does it in one line per word. Trap: picking the option that handles the normal case but not the edges. Check every choice against an empty array, one item, repeats, negative numbers and null.
How to prepare
- Read your invitation first. Find out which platform you will use, how many tasks there are, the time limit, which Java version the editor runs, and whether the test is monitored. Formats vary too much to assume.
- Try the platform's practice area if it has one. Get used to the editor, the Run button, how input is read and how sample test cases are shown, so the screen is not new on the day. HackerRank, for example, describes candidates clicking Run to run the test cases while they work (HackerRank Support).
- Trace code by hand. For short snippets, write each variable's value and type after every line. Integer division, string joining and references are where most surprises hide.
- Know the everyday tools. Arrays,
StringandStringBuilder,ArrayList,HashMap,HashSet,Arrays.sortandCollections.sort,equalsandhashCode, exceptions, and basic classes and interfaces. - Think about edge cases before you submit. Empty arrays and strings, one item, repeated values, negative numbers,
null, and values large enough to overflow anint. Hidden test cases often check exactly these. - Write some code against the clock. Our mocks train reading and debugging. Also solve a few small problems in a real editor with a timer, so writing, compiling and running code under pressure feels normal.
- Practice at the real pace. If your test is like HackerRank's Java (Basic) example, 6 questions in 1 hour gives about 10 minutes a question (HackerRank). Take full timed mocks so pacing yourself feels normal.
How scoring usually works
Scoring depends on the platform and the employer. There is no universal scale and no universal pass mark. Coding questions are usually scored automatically against test cases. Two public descriptions:
- HackerRank says coding questions are evaluated with predefined test cases that measure correctness and efficiency. Each test case has its own score: code that passes a test case receives that test case's full score, and code that fails it receives zero. The question's total is the sum of the test cases passed, so a solution that passes some test cases earns part of the points (HackerRank Support). Coding and multiple choice questions are evaluated automatically, while back-end questions are evaluated automatically with a manual review recommended (HackerRank Help).
- TestGorilla describes percentile-based scoring based on overall correctness, meaning whether given inputs produce the correct outputs, and a report showing each test case's result (TestGorilla).
What counts as a good result is up to each employer, and many look at your code as well as the score.
Our practice score is the number of our own questions you answered correctly, with a breakdown by section, so you can see where to focus. It is a practice score: it is not a score on any platform's test and does not predict whether you will pass.
Common mistakes
- Comparing strings with
==. Useequals, or"text".equals(value)when the value might benull. - Expecting decimals from integer division.
7 / 2is 3. Make one side adoublefirst when you need 3.5. - Forgetting that strings are immutable.
s.trim()ands.toUpperCase()return new strings; assign the result. - Off-by-one errors in loops. Indexes run from 0 to
length - 1, so the usual loop test isi < a.length. - Changing a list inside a for-each loop. Use
removeIfor an explicitIteratorand itsremovemethod. - Ignoring overflow. Sums and products of large
intvalues can wrap around silently. Uselongwhen values can grow. - Only testing the example. The visible example usually passes. Hidden test cases check empty input, single items, duplicates and large inputs.
- Running out of time on one task. If you are stuck, submit a simple version that passes some test cases, move on, and come back if time allows.
Original practice questions, never real or leaked ones. Cancel the monthly plan any time, and ask for a refund within 7 days if you have taken no more than one full mock.
Frequently asked questions
Is there one standard Java coding test?+
No. Each employer picks a platform and sets its own questions, length, time limit and languages. Your test invitation says what yours includes, and some platforms offer a practice area to try first.
Do your mocks run the code I write?+
No. Our mocks practice reading, tracing, debugging and choosing Java code with multiple choice questions. Many real tests ask you to write code that is run against hidden test cases, so practice writing small programs in a real editor too.
Which version of Java do the questions use?+
Java 17. The questions stick to the core language and standard library, with no frameworks such as Spring. Check your own test invitation for the version the platform runs.
What score do I need to pass?+
There is no universal pass mark. Platforms score coding questions against test cases, and each employer decides what result moves you forward, often looking at your code as well.
Are these real Java test questions?+
No. These are original practice questions written by our team in a similar style. Intellect Council is not affiliated with HackerRank, TestGorilla or any other testing platform or employer.
Sources
- HackerRank: Java (Basic) skills test page, checked 2026-11-09
- HackerRank Help: Question types in HackerRank tests, checked 2026-11-09
- HackerRank Help: Scoring questions (overview), checked 2026-11-09
- HackerRank Support: Coding question, scoring a coding question in tests, checked 2026-11-09
- TestGorilla: Java coding tests, checked 2026-11-09
Related practice
Practice tests for job seekers
Free timed practice tests for employer tests: aptitude, reasoning, psychometric, Wonderlic-style, CCAT-style and Excel. No account needed to start.
ExplorePython coding test practice
Free Python assessment practice: concepts, what the code prints, finding the bug and choosing a working solution, each traced step by step.
ExploreSQL test practice
Free SQL test practice: concepts, what a query returns, fixing a query and choosing the right one, in portable standard SQL, each traced step by step.
ExploreWalk in prepared.
Leave knowing you did your best.
Timed practice in the real format, with every answer explained.