Java Learner logo

Training

Practice Java syntax by predicting console output.

Choose an exercise, read the snippet, and write the exact output before you ever run the code.

  • Trace collections, strings, and loops without a compiler
  • Instant feedback that nudges you toward the right answer
  • Hints appear after the second attempt if you get stuck

Challenges

Pick a focused exercise to start practicing.

Each card opens a dedicated route where you can work through the snippet and get tailored feedback.

8 curated drills

Collections

Iterating an ArrayList

Beginner

Predict exactly what the console prints after the loop runs.

SnippetsHintsInstant feedback

Maps

Keeping insertion order

Intermediate

Fill in the two lines that this LinkedHashMap iteration will print.

SnippetsHintsInstant feedback

Strings

Tweaking text with StringBuilder

Beginner

Type the exact line printed, including spaces and capitalization.

SnippetsHintsInstant feedback

Control Flow

Flow control with break/continue

Intermediate

What single number reaches System.out.println at the end?

SnippetsHintsInstant feedback

Streams

Chaining Stream operations

Intermediate

Write the exact string printed when this stream pipeline executes.

SnippetsHintsInstant feedback

Optional

Optional filtering

Beginner

Predict the two lines printed when working with Optional.filter + orElseGet.

SnippetsHintsInstant feedback

Collections

Deque pushes vs polls

Intermediate

Determine the three lines printed after mixing add, push, and poll operations.

SnippetsHintsInstant feedback

Maps

Merging HashMap values

Advanced

Observe how Map.merge mutates entries; type the two numbers printed.

SnippetsHintsInstant feedback