Career upgrade: Learn practical AI skills for better jobs and higher pay.
Level up
All Practice Exams

100+ Free Oracle Java SE 21 Practice Questions

Pass your Oracle Certified Professional: Java SE 21 Developer (1Z0-830) exam on the first try — instant access, no signup required.

✓ No registration✓ No credit card✓ No hidden fees✓ Start practicing immediately
100+ Questions
100% Free
1 / 100
Question 1
Score: 0/0

How do you create a custom Collector for the Stream API?

A
B
C
D
to track
Same family resources

Explore More Oracle Certifications

Continue into nearby exams from the same family. Each card keeps practice questions, study guides, flashcards, videos, and articles in one place.

2026 Statistics

Key Facts: Oracle Java SE 21 Exam

50

Exam Questions

90-minute time limit

68%

Passing Score

Oracle standard

$245

Exam Fee

Per attempt

Java 21

Version Tested

Latest LTS release

No

Prerequisites

Experience recommended

Remote

Testing Available

Pearson VUE online

The 1Z0-830 exam has 50 multiple-choice questions with a 90-minute time limit and 68% passing score. It covers Java 21 features (virtual threads, pattern matching, records), OOP, streams/lambdas, concurrency, modules, and JDBC. The exam costs $245.

Sample Oracle Java SE 21 Practice Questions

Try these sample questions to test your Oracle Java SE 21 exam readiness. Each question includes a detailed explanation. Start the interactive quiz above for the full 100+ question experience with AI tutoring.

1Which keyword is used to define a class in Java?
A.struct
B.class
C.define
D.object
Explanation: The 'class' keyword is used to define a class in Java. A class is a blueprint for creating objects and encapsulates data (fields) and behavior (methods). Java is an object-oriented language where classes are the fundamental building blocks.
2What is the correct way to declare the main method in Java?
A.public void main(String[] args)
B.public static void main(String[] args)
C.static void main()
D.public static int main(String[] args)
Explanation: The correct signature for the main method is 'public static void main(String[] args)'. It must be public (accessible by the JVM), static (called without creating an object), void (returns nothing), and accept a String array parameter for command-line arguments.
3What is encapsulation in Java?
A.Inheriting properties from a parent class
B.Bundling data and methods that operate on that data within a single unit (class) and restricting direct access to the data
C.Converting objects to strings
D.Running multiple threads simultaneously
Explanation: Encapsulation is an OOP principle that bundles data (fields) and methods that operate on that data within a single class, and restricts direct access to the internal state using access modifiers (private, protected). It promotes data hiding and provides controlled access through getter and setter methods.
4Which access modifier makes a member accessible only within the same class?
A.public
B.protected
C.private
D.default
Explanation: The 'private' access modifier restricts access to only within the same class. Private members cannot be accessed by subclasses or other classes in the same package. This is the most restrictive access level and is fundamental to encapsulation.
5What is a record in Java 21?
A.A type of logging mechanism
B.A compact, immutable data carrier class that auto-generates constructor, accessors, equals(), hashCode(), and toString()
C.A database table reference
D.A type of annotation
Explanation: Records, introduced as a preview in Java 14 and finalized in Java 16, are compact classes designed as transparent carriers for immutable data. A record automatically generates a canonical constructor, accessor methods, equals(), hashCode(), and toString() based on its components, reducing boilerplate code significantly.
6What is a sealed class in Java 21?
A.A class that cannot be instantiated
B.A class that restricts which other classes can extend or implement it using the 'permits' clause
C.A class stored in a sealed JAR file
D.A final class with no methods
Explanation: Sealed classes, finalized in Java 17, restrict which classes can extend them by using the 'sealed' modifier and a 'permits' clause listing the allowed subclasses. This gives developers explicit control over their class hierarchies and works well with pattern matching in switch expressions.
7What is a lambda expression in Java?
A.A named method in a class
B.A concise representation of an anonymous function that can be passed as an argument or stored in a variable
C.A type of loop construct
D.A debugging tool
Explanation: A lambda expression is a concise way to represent an anonymous function (a method without a name). Introduced in Java 8, lambdas enable functional programming by allowing you to pass behavior as arguments to methods, store them in variables, and use them with functional interfaces like Predicate, Function, and Consumer.
8What does the Stream API in Java provide?
A.File I/O streaming
B.A functional-style API for processing sequences of elements with operations like filter, map, and reduce
C.Network socket streaming
D.Audio/video streaming
Explanation: The Java Stream API (java.util.stream) provides a functional-style approach to processing sequences of elements. Streams support operations like filter, map, flatMap, reduce, collect, and forEach, enabling declarative data processing pipelines that can be executed sequentially or in parallel.
9What is the purpose of the 'extends' keyword in Java?
A.To extend the length of an array
B.To establish an inheritance relationship where a subclass inherits from a superclass
C.To extend the timeout of a method
D.To increase memory allocation
Explanation: The 'extends' keyword establishes an inheritance relationship in Java. A subclass uses 'extends' to inherit fields and methods from a superclass. Java supports single inheritance for classes (one superclass only), promoting code reuse and establishing is-a relationships between types.
10What is the purpose of the 'module-info.java' file in Java?
A.To store module documentation
B.To define a Java module's dependencies, exported packages, and service declarations
C.To configure the JVM runtime
D.To list module test cases
Explanation: The module-info.java file defines a Java module introduced in Java 9 (Project Jigsaw). It declares the module name, its dependencies (requires), which packages it exports (exports), which services it provides or uses, and which packages it opens for reflection. This enables strong encapsulation at the package level.

About the Oracle Java SE 21 Exam

The Oracle Java SE 21 Developer certification validates proficiency in Java 21 features including virtual threads, pattern matching, records, sealed classes, streams, concurrency, and the module system.

Questions

100 scored questions

Time Limit

90 minutes

Passing Score

68%

Exam Fee

$245 (Oracle (Pearson VUE))

Oracle Java SE 21 Exam Content Outline

25%

OOP Fundamentals & Core APIs

Classes, interfaces, inheritance, generics, exceptions, String, collections, JDBC, try-with-resources

20%

Streams & Lambda Expressions

Functional interfaces, lambdas, method references, Stream API, Optional, Collectors, parallel streams

20%

Concurrency & Multithreading

Threads, ExecutorService, synchronized, volatile, concurrent collections, atomic variables, locks

15%

Modules & Packages

Module system, module-info.java, requires, exports, opens, ServiceLoader, automatic modules

20%

Java 21 Features

Records, sealed classes, pattern matching (instanceof/switch), text blocks, virtual threads, sequenced collections

How to Pass the Oracle Java SE 21 Exam

What You Need to Know

  • Passing score: 68%
  • Exam length: 100 questions
  • Time limit: 90 minutes
  • Exam fee: $245

Keys to Passing

  • Complete 500+ practice questions
  • Score 80%+ consistently before scheduling
  • Focus on highest-weighted sections
  • Use our AI tutor for tough concepts

Oracle Java SE 21 Study Tips from Top Performers

1Practice reading Java code without an IDE — the exam requires mental code tracing and output prediction
2Focus on Java 21 features: virtual threads, pattern matching in switch with guards (when clause), record patterns
3Master Stream API operations thoroughly — know the difference between intermediate and terminal operations
4Understand the Java module system: requires, exports, opens, provides/uses, transitive dependencies
5Study concurrency deeply: synchronized vs ReentrantLock, volatile, atomic classes, ExecutorService
6Know record details: canonical constructors, compact constructors, immutability, automatically generated methods

Frequently Asked Questions

What is the Oracle Java SE 21 Developer certification (1Z0-830)?

The 1Z0-830 is Oracle's professional-level Java certification validating expertise in Java SE 21. It covers OOP, streams/lambdas, concurrency, modules, and Java 21 features like virtual threads, records, sealed classes, and pattern matching. The exam has 50 questions with a 90-minute time limit and 68% passing score.

What Java 21 features are tested on the 1Z0-830 exam?

Key Java 21 features tested include virtual threads (JEP 444), pattern matching for switch (JEP 441), record patterns (JEP 440), sequenced collections (JEP 431), and preview features like structured concurrency and scoped values. Records, sealed classes, text blocks, and switch expressions (finalized in earlier versions) are also covered.

How difficult is the Oracle Java SE 21 exam?

The 1Z0-830 is considered one of the more challenging IT certifications. Questions test deep understanding of Java concepts, not just surface knowledge. Code analysis questions require tracing execution and predicting output. Most candidates need 6-10 weeks of focused study and significant hands-on Java programming experience.

What is the difference between the Java SE 21 (1Z0-830) and older Java certifications?

The 1Z0-830 replaces the Java SE 17 (1Z0-829) certification. It adds Java 21 features like virtual threads, sequenced collections, record patterns, and enhanced pattern matching in switch. If you hold an older Java certification, you can upgrade by taking the 1Z0-830 directly — no upgrade path exam is needed.

Can I use an IDE during the Oracle Java SE 21 exam?

No, the exam is taken without access to an IDE, compiler, or Java documentation. You must be able to read, analyze, and trace Java code mentally. Practice reading code on paper or screen without running it to prepare for this aspect of the exam.