Java 17 1Z0-829 cheat sheet for Java developer traps, APIs, code reading, and final review.
On this page
Use this for last-mile review. The goal is not to relearn Java. The goal is to stop the avoidable misses that come from skipping one type, one bound, or one API contract.
1Z0-829 answer sequence
Use this when the stem mixes compile-time legality, declared type, collections, streams, or modern Java features.
flowchart TD
S["Snippet or scenario"] --> C["Does it compile?"]
C --> T["What is the exact declared type?"]
T --> L["Check language, collection, or stream contract"]
L --> R["Predict output, mutation, or exception"]
Read every snippet in this order
Does it compile?
What is the exact declared type on every side?
Which contract is really under test: language rule, collection rule, stream rule, exception rule, or module rule?
Only then predict output, mutation, ordering, or thrown exception.
Compile-vs-runtime triage
Ask this first
Why it matters
Does the code compile at all?
many distractors disappear before runtime
What is the exact declared type?
overload choice, method visibility, and generics depend on it
Is the object mutable, fixed-size, or unmodifiable?
collection questions often hide here
Is the stream already consumed?
streams are single-use pipelines
Is the exception checked or unchecked?
the handling requirement changes immediately
Type and assignment reminders
Rule lane
Fast reminder
declaration vs runtime type
method visibility and overload choice start from the declared type
numeric literal default
integral literals default to int, decimal literals to double
cast legality
a cast can compile and still fail at runtime
wrapper null
unboxing a null wrapper throws NullPointerException
var
local-only and initializer-driven; it does not mean dynamic typing
Overload and conversion order
Rule lane
Fast reminder
exact match
strongest candidate when legal
primitive widening
often chosen before boxing
boxing and unboxing
legal, but can create ambiguity or NullPointerException
varargs
fallback applicability lane
compound assignment
may include implicit cast behavior that plain assignment rejects
Modern Java 17 feature-status map
Feature
Status to remember
records
permanent
sealed classes and interfaces
permanent
pattern matching for instanceof
permanent
switch expressions
permanent
text blocks
permanent
Java 17 feature quick map
Feature
Best recall
record
concise data carrier with generated members
sealed
restricts who may extend or implement
text block
multiline string syntax that still yields a String
modern switch
value-producing switch expressions with yield
pattern matching for instanceof
type test plus safe binding
Flow and pattern reminders
Topic
Fast rule
switch expression
every reachable path must yield a value or throw
pattern variable scope
usable only where the match is definitely true
fall-through instinct
old switch habits often break modern switch reasoning
yield
returns a value from a block switch arm, not from the method
guarded logic
resolve legality first, then branch result
Classes, records, and inheritance
Topic
Better recall
constructor chain
this(...) or super(...) comes first in a constructor
record constructor
compact constructor validates or normalizes state
override legality
check access, return type, throws, and static/instance mismatch
default-method conflict
class wins, then most-specific interface logic applies
sealed hierarchy
permitted subtypes must obey the sealing rules exactly
Collections and generics chooser
Requirement
Strongest first recall
immutable factory list
List.of(...)
fixed-size list backed by array
Arrays.asList(...)
producer source
? extends T
consumer sink
? super T
generic type relationship
invariance still applies
ordered result assumptions
use the actual collection contract, not habit
Collections and generics traps
Trap
Better rule
Arrays.asList(...) is immutable
it is fixed-size, not fully unmodifiable
List.of(...) behaves like ArrayList
it is unmodifiable and rejects null
List<Child> is a subtype of List<Parent>
generics are invariant
wildcard direction is cosmetic
extends reads from a producer, super writes to a consumer
set/list order is obvious from variable name
trust the implementation contract only
Streams, Optional, and collectors
Requirement
Strongest first fit
transform each element
map
keep only matching elements
filter
flatten nested sources
flatMap
group or reduce to a result shape
collector choice matters
absent value handling
Optional is not a collection and not a null wrapper hack
parallel use
only when order and shared-state assumptions still hold