Browse Exams — Mock Exams & Practice Tests

1Z0-830 Cheatsheet — Java SE 21 (Generics, Streams, Exceptions, Concurrency)

Last-mile 1Z0-830 review: high-yield Java 21 rules and code patterns for generics, collections, streams, exceptions, and concurrency fundamentals.

Use this for last‑mile review. The exam rewards “small correctness details”.


1) Generics variance (the two rules)

PatternWhat it means
List<? extends T>you can read T (or subtype); you can’t add T safely
List<? super T>you can add T; reads come back as Object

2) Streams: common patterns

Filter → map → collect

1var names = people.stream()
2    .filter(p -> p.age() >= 18)
3    .map(Person::name)
4    .toList();

Grouping

1var byDept = employees.stream()
2    .collect(Collectors.groupingBy(Employee::department));

3) Exceptions: high-yield reminders

  • Checked exceptions must be declared or handled.
  • Prefer try-with-resources for AutoCloseable.
1try (var in = Files.newInputStream(path)) {
2  // ...
3}

4) Concurrency: safe defaults

  • Prefer executors over manual thread management for pools (concept-level).
  • Avoid sharing mutable state; use immutability where possible.