Oracle Java SE 17 Developer Exam Practice Test
The Oracle Java SE 17 Developer Exam (1Z0-829) practice page focuses on reading and reasoning about Java code. Available questions sample declarations and expressions, arrays, strings, collections, enums, generics, and date-time values, with short code snippets that call for tracing results or choosing valid syntax.
Exam overview
About the Oracle Java SE 17 Developer Exam
Java development requires recognizing how types, objects, and language constructs affect a program’s behavior. Practice with declarations and expressions by checking variable types, increment operations, array dimensions, and the difference between array length and collection size. For collections, reason about duplicate elements in sets and missing-key behavior in maps. Work through enum-based switch expressions, generic method signatures, and `String` operations by verifying both syntax and resulting values. Date-time questions can build familiarity with creating `LocalDate` values using the Java API. These skills support code review and implementation tasks such as selecting an appropriate data structure, interpreting a method’s return value, and spotting a mismatch between intended behavior and actual execution.
Sample Practice Questions
Review a selection from this exam's published US Practice Tests practice bank.
Which declaration creates an array that can hold five `double` values?
Show answer
Correct answer: BThe `double[]` type denotes an array of doubles, and `new double[5]` creates an array with five elements. The elements initially have the default value `0.0`.
What is the value of `number` after this code runs? `int number = 5; number++;`
Show answer
Correct answer: CThe postfix increment operator increases the variable's value by one. After the statement, `number` is 6.
Which statement about a `switch` expression over an enum is correct?
Show answer
Correct answer: BFor an enum switch expression, listing every enum constant makes the switch exhaustive without a `default`. If a new constant is later added and not handled, the switch may no longer be exhaustive and compilation can fail.
What is the value of `size` after this code executes? ```java var set = new java.util.HashSet<Integer>(); set.add(4); set.add(7); set.add(4); int size = set.size(); ```
Show answer
Correct answer: BA `HashSet` stores unique elements. Adding 4 a second time does not add another element, so the set contains 4 and 7 and has size 2.
What is printed by this code? `String text = "cat"; System.out.println(text.length());`
Show answer
Correct answer: BThe string `"cat"` contains three characters, and `String.length()` returns the number of characters in the string.
Which declaration correctly creates a `LocalDate` for January 2, 2024?
Show answer
Correct answer: B`LocalDate` is immutable and is created using factory methods such as `LocalDate.of(year, month, dayOfMonth)`. It does not provide a public constructor with those arguments.
Which statement about a `static` field in Java is correct?
Show answer
Correct answer: CA static field is associated with the class, so instances share the class-level field rather than each owning an independent copy.
How to use this practice test
Access is free. When questions are available, a session presents up to 20 random items from the 50-question practice bank and shows results afterward. Use each session to identify which Java constructs need closer code tracing, then revisit the relevant syntax and API behavior.
Preparation tips
- Trace each expression in order, especially post-increment operations, and record the variable’s value after the statement.
- Compare arrays, sets, and maps by checking their size or lookup behavior; test how duplicates and absent keys affect results.
- Practice reading enum switch expressions and generic method declarations, checking both valid syntax and the resulting type or value.
- Write small examples with `String.length()` and `LocalDate.of(...)` to confirm method behavior and argument ordering.
- For multidimensional arrays, distinguish the outer array length from the length of each nested array.