1Z0-830 — Oracle Java SE 21 Developer Professional Cheat Sheet
Last revised: September 28, 2026
Cheat sheet: exam-prep reference for Oracle Java SE 21 Developer Professional (1Z0-830): Java 21 rules, APIs, modules, streams, JDBC, and traps.
Use the tables for a quick pre-exam check. Expand a topic’s notes for explanations, examples, and additional distinctions.
Scope and study context
Unless a question explicitly states that preview features are enabled, answer using standard Java SE 21 features only. Java 21 includes preview/incubator features, but exam-safe reasoning should not assume them.
Review the tables and decision rules.
Mark topics where you hesitate.
Drill those topics in a question bank.
Read explanations carefully, especially for compile-time errors and small output differences.
The real challenge on 1Z0-830 is rarely remembering one isolated API call. It is usually reading Java code exactly: scope, overload resolution, generics, stream laziness, exception flow, object identity, module visibility, concurrency behavior, and Java SE 21 language features.
High-yield topic map
Area
Know cold
Common trap
Core language
numeric promotion, var, initialization order, access control, overloading/overriding
Overload chosen at compile time; override dispatched at runtime
OOP
interfaces, abstract classes, nested classes, enums, sealed types, records
Static methods are hidden, not overridden
Java 21 patterns
pattern matching for switch, record patterns, guarded patterns
Accessible through this, super, or a reference of the subclass type, not arbitrary superclass instances
Garbage collection
Eligibility is based on reachability; System.gc() is only a request
Notes and examples
var quick rules
Valid
Invalid / trap
Local variables with initializer
Fields, method parameters, method return types
Enhanced for variables
var x; with no initializer
Lambda parameters when all explicit parameters use var
Mixing var and explicit/implicit lambda parameter styles
Inferred compile-time type
Dynamic typing; it is not JavaScript-style var
var a = new int[] {1, 2};
var a = {1, 2};
varnames=List.of("Ada","Linus");// List<String>varcount=10;// int, not Integer// Valid: all lambda parameters use varBiFunction<String,String,Integer>len=(vara,varb)->a.length()+b.length();
Numeric, boolean, and text traps
Topic
Rule
Binary numeric promotion
byte, short, and char promote to int in arithmetic
Promotion order
double > float > long > int
Compound assignment
Includes implicit cast: b += 1 can compile where b = b + 1 may not
Integer division
Truncates toward zero
Floating NaN
Comparisons with NaN are false except !=
Wrapper equality
Prefer equals; do not rely on == object identity
String immutability
Concatenation creates new strings unless optimized by compiler/runtime
StringBuilder.equals
Does not compare contents unless overridden by another class; use toString() or compare manually
Text blocks
Preserve newlines and use incidental indentation rules
_ identifier
Reserved; do not use as a variable name in standard Java 21 code
Control flow
Feature
Key exam rule
if
Condition must be boolean, not numeric
switch statement
May fall through with colon labels unless break, return, throw, etc.
switch expression
Must produce a value on every path; use yield in block arms
Arrow switch label
No fall-through
for
Init/update sections can contain comma-separated expressions
Enhanced for
Iterates arrays or Iterable; loop variable is a copy/reference, not the collection slot
Labels
Work with loops/blocks; break label exits labeled statement; continue label targets loop
Colon-style labels can fall through unless break, return, throw, or similar control flow stops them. Arrow labels do not fall through.
Exhaustiveness
Switch expressions must cover all possible selector values.
default and null
Treat null deliberately. In Java SE 21 pattern switch code, look for case null; do not casually assume default is a null handler in ordinary switch reasoning.
Pattern dominance
A broader pattern before a narrower one can make the narrower case unreachable.
Guards
when guards affect whether a pattern label applies.
OOP, interfaces, records, sealed classes, and patterns
Overloading vs overriding
Feature
Overloading
Overriding
Resolved
Compile time
Runtime
Based on
Reference type and argument types
Actual object type
Return type only
Cannot overload by return type only
Covariant return allowed
Access
Any valid overload
Cannot reduce visibility
Exceptions
Independent
Checked exceptions must be same/narrower; unchecked flexible
Static methods
Can be overloaded
Hidden, not overridden
Private methods
Can be overloaded
Not inherited; not overridden
final methods
Can be overloaded
Cannot be overridden
Notes and examples
classParent{Numbervalue()throwsIOException{return1;}staticvoidlabel(){}}classChildextendsParent{@OverrideIntegervalue()throwsFileNotFoundException{return2;}// covariant + narrowerstaticvoidlabel(){}// hides, does not override}
Interface rules
Rule
Detail
Fields
Implicitly public static final
Abstract methods
Implicitly public abstract unless default, static, or private
Default methods
Inherited unless class/superclass method wins or conflict must be resolved
Static interface methods
Called with interface name, not inherited as instance methods
Private interface methods
Helper methods for default/static methods
Conflict rule
Class wins; otherwise most specific interface wins; otherwise implementing class must override
Nested, local, and anonymous classes
Type
Key points
Static nested class
No enclosing instance required
Inner member class
Requires enclosing instance; can access outer instance members
Local class
Declared inside block; can access effectively final local variables
Anonymous class
Extends one class or implements one interface; cannot declare constructor
Lambda vs anonymous class
In lambda, this refers to enclosing instance; in anonymous class, this is the anonymous object
Enums
Rule
Detail
Constants first
Enum constants must appear before fields/methods
Constructor
Implicitly private; never called with new
Methods/fields
Allowed after semicolon
Per-constant behavior
Constants can override abstract/regular methods
API
values(), valueOf(String), name(), ordinal()
Collections
Prefer EnumSet and EnumMap for enum keys/sets
Trap
Do not persist or compare business meaning with ordinal()
Records
Records are transparent data carriers, but they are only shallowly immutable.
Feature
Rule
Declaration
record Point(int x, int y) {}
Generated members
Private final fields, public accessors x(), y(), canonical constructor, equals, hashCode, toString
Inheritance
Records are final and extend java.lang.Record
Interfaces
Records can implement interfaces
Extra fields
Static fields allowed; additional instance fields are not
Compact constructor
Validate/normalize parameters; compiler assigns fields after body
Records are compact carriers for shallowly immutable data.
recordPoint(intx,inty){}
The compiler provides:
private final fields for components
public accessor methods named x() and y()
canonical constructor
equals, hashCode, and toString
Record review table:
Point
Rule
Inheritance
A record cannot extend another class and is implicitly final.
Interfaces
A record can implement interfaces.
Fields
Extra instance fields are not allowed; static fields are allowed.
Constructors
Canonical and compact constructors are common exam targets.
Accessors
Accessors are named after components, not getX().
Mutability
Record fields are final, but referenced objects can still be mutable.
Compact constructor trap:
recordRange(intstart,intend){Range{if(start>end)thrownewIllegalArgumentException();// assignments to components happen automatically after this block}}
Sealed classes and interfaces
Sealed types restrict which classes or interfaces can directly extend or implement them.
Executes on current thread; does not start a new thread.
Calling start() twice
Throws IllegalThreadStateException.
Assuming output order
Thread scheduling is not deterministic.
Ignoring interruption
Interrupted status and blocking methods matter.
Forgetting shutdown()
Executor may keep application alive or leak resources.
Using non-thread-safe collections
Can corrupt state or produce unpredictable results.
Deadlock
Can occur when locks are acquired in inconsistent order.
JDBC quick reference
Core interfaces
Interface
Role
DriverManager
Obtain connections using JDBC URL
DataSource
Preferred managed connection factory in many applications
Connection
Database session and transaction boundary
Statement
Static SQL; avoid for user input
PreparedStatement
Parameterized SQL; helps prevent SQL injection
CallableStatement
Stored procedures
ResultSet
Cursor over query results
SQLException
Database access error with SQL state/vendor code
Notes and examples
JDBC operation rules
Rule
Detail
Indexing
Parameters and result-set column indexes are 1-based
Cursor
ResultSet starts before first row; call next()
executeQuery
For SQL returning a ResultSet
executeUpdate
For DML/DDL returning update count
execute
For unknown/multiple result types
Auto-commit
Common default is auto-commit enabled on new connections
Transaction
Disable auto-commit, then commit or rollback
Resources
Close ResultSet, Statement, and Connection; use try-with-resources
Batch
addBatch, executeBatch
SQL injection
Use bind parameters, not string concatenation
Stringsql="select name from employee where id = ?";try(Connectioncon=dataSource.getConnection();PreparedStatementps=con.prepareStatement(sql)){ps.setLong(1,employeeId);try(ResultSetrs=ps.executeQuery()){if(rs.next()){returnrs.getString("name");}}}
try(Connectioncon=dataSource.getConnection();PreparedStatementps=con.prepareStatement("select name from employee where id = ?")){ps.setInt(1,id);try(ResultSetrs=ps.executeQuery()){while(rs.next()){System.out.println(rs.getString(1));}}}
JDBC review table
Topic
Rule
Parameter indexes
PreparedStatement parameters are 1-based.
Column indexes
ResultSet column indexes are 1-based.
Cursor
ResultSet starts before the first row; call next().
executeQuery
Used for queries returning a result set.
executeUpdate
Used for DML/DDL-style operations returning an update count.
execute
Can handle multiple result types; returns boolean indicating result set availability.
Auto-commit
Common default is auto-commit enabled; know when code disables it.
Transactions
Use commit and rollback when auto-commit is disabled.
SQL injection
Prefer PreparedStatement with bind parameters.
Common trap: PreparedStatement prevents SQL injection only when values are bound as parameters, not when user input is concatenated into SQL text before preparing.
Annotations and secure coding
Annotation rules
Feature
Rule
Retention
SOURCE, CLASS, RUNTIME
Target
Restricts where annotation may appear
Element types
Primitive, String, Class, enum, annotation, arrays of these
Defaults
Annotation elements can declare default values
Null
Annotation element values cannot be null
Marker annotation
No elements
Single-value convention
Element named value may omit name
Repeatable annotation
Uses @Repeatable(container)
@Inherited
Applies only to class inheritance, not methods/interfaces generally
exported vs opened packages, class path vs module path
Object-oriented programming
Overloading vs overriding
Topic
Overloading
Overriding
Binding
Compile-time
Runtime polymorphism
Based on
Method name and parameter list
Same signature after inheritance rules
Return type
Not enough by itself
Same or covariant return allowed
Static methods
Can be overloaded
Hidden, not overridden
Private methods
Can be redeclared
Not overridden
Checked exceptions
Not central to selection
Cannot throw broader checked exceptions
Notes and examples
High-yield rule: the reference type selects overloaded methods; the runtime object selects overridden instance methods.
classA{voidm(Objecto){System.out.print("A-Object");}voidn(){System.out.print("A");}}classBextendsA{voidm(Strings){System.out.print("B-String");}// overload@Overridevoidn(){System.out.print("B");}}Ax=newB();x.m("hi");// A-Objectx.n();// B
Constructors and initialization
Review order:
Static fields and static initializers, superclass first.
Instance fields and instance initializers, superclass first.
Superclass constructor.
Subclass instance fields/initializers and constructor body.
Constructor rules:
A constructor call to this(...) or super(...) must be the first statement when explicit.
If no constructor is declared, a default no-argument constructor is provided.
If any constructor is declared, no default constructor is automatically added.
Abstract classes can have constructors.
Interfaces do not have constructors.
Interfaces
Interface member
Key rule
Fields
Implicitly public static final.
Abstract methods
Implicitly public abstract unless default/static/private.
Default methods
Inherited by implementing classes; conflicts must be resolved.
Static methods
Called on the interface name, not inherited like instance methods.
Private methods
Can support default/static methods inside the interface.
Conflict rule: if a class inherits conflicting defaults, it must override and choose or provide behavior. A superclass instance method generally wins over an interface default.
Lambdas, method references, and functional interfaces
Core functional interfaces
Interface
Abstract method shape
Example use
Predicate<T>
T -> boolean
filtering
Function<T,R>
T -> R
mapping
Consumer<T>
T -> void
side effects
Supplier<T>
() -> T
lazy creation
UnaryOperator<T>
T -> T
same-type transform
BinaryOperator<T>
(T,T) -> T
reductions
Comparator<T>
(T,T) -> int
sorting
Lambda rules:
Captured local variables must be final or effectively final.
The target type must be a functional interface.
Parameter types can be explicit, inferred, or all var; do not mix styles.
A block lambda with a non-void target must return a value on all paths.
Reduction trap: for parallel streams, accumulator and combiner must be associative and compatible with the identity. Side effects in reductions are a common source of wrong answers.
Optional
API
Review point
of(value)
Throws if value is null.
ofNullable(value)
Empty if value is null.
get()
Throws if empty. Usually avoid unless presence is certain.
orElse(value)
Evaluates the fallback eagerly.
orElseGet(supplier)
Evaluates fallback lazily.
map
Transforms contained value.
flatMap
Avoids nested Optional.
Secure and robust coding themes
Oracle Java SE 21 Developer Professional (1Z0-830) candidates should be comfortable recognizing safer coding choices in ordinary Java code.
Theme
Exam-relevant habit
Encapsulation
Keep fields private; expose controlled behavior.
Immutability
Prefer final fields and defensive copies for mutable inputs/outputs.
Input validation
Validate boundaries before use.
SQL safety
Use bind parameters instead of string concatenation.
Serialization caution
Do not deserialize untrusted data casually.
Resource management
Use try-with-resources for closeable resources.
Concurrency safety
Avoid unsynchronized shared mutable state.
Error handling
Do not swallow exceptions without meaningful handling.
Common candidate mistakes
Mistake
Better exam habit
Reading code as intended instead of written
Trace exact compile-time and runtime behavior.
Assuming all collections preserve insertion order
Identify concrete collection type and contract.
Treating var as dynamic
Infer the compile-time type immediately.
Forgetting stream laziness
Mark the terminal operation before predicting side effects.
Reusing a stream
A consumed stream cannot be reused.
Confusing overload and override
Resolve overload first by reference type and arguments.
Ignoring checked exceptions
Ask whether the method catches or declares them.
Assuming parallel stream order
Look for ordered terminal operations and source ordering.
Component references can point to mutable objects.
Quick practice plan
Use this Cheat Sheet as a map for IT Mastery practice:
Start with topic drills. Work small sets on language basics, OOP, records/sealed types, generics, streams, exceptions, modules, I/O, concurrency, and JDBC.
Review every detailed explanation. For missed questions, identify whether the error was compilation, API behavior, output tracing, or concept confusion.
Build a personal trap list. Include examples such as Arrays.asList, orElse eagerness, switch exhaustiveness, wildcard capture, and try-with-resources close order.
Move to mixed sets. Once topic scores stabilize, use mixed original practice questions to simulate context switching.
Finish with mock exams. Practice pacing and answer discipline. Do not change answers unless you find a specific code rule you missed.
Final review checklist before mock exams
You are ready for full-length practice when you can quickly answer:
Does this snippet compile?
Which overload is selected?
Which method is overridden at runtime?
Is the collection ordered, sorted, immutable, fixed-size, or a view?
Is a stream operation intermediate or terminal?
Can this lambda capture the variable?
Is the generic assignment safe, unsafe, or illegal?
What happens if this Optional is empty?
Which exception is caught, suppressed, or thrown?
Does the NIO operation normalize text or access the real file system?
Is this concurrency result deterministic?
Is this JDBC call using the right execution method and index?
Is this package exported, opened, both, or neither?
Next step: choose your weakest three topics from this page and work targeted question bank drills with original practice questions and detailed explanations before attempting another mixed mock exam.