IT Certifications · 1Z0-829

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

Exam providerOracle
Exam code1Z0-829
CategoryIT Certifications

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.

Question 1

Which declaration creates an array that can hold five `double` values?

  1. A`double values = new double[5];`
  2. B`double[] values = new double[5];`
  3. C`double values[] = new double();`
  4. D`Array<double> values = new Array<double>(5);`
Show answerCorrect answer: B

The `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`.

Question 2

What is the value of `number` after this code runs? `int number = 5; number++;`

  1. A4
  2. B5
  3. C6
  4. DThe code does not compile
Show answerCorrect answer: C

The postfix increment operator increases the variable's value by one. After the statement, `number` is 6.

Question 3

Which statement about a `switch` expression over an enum is correct?

  1. AA switch expression must include a `default` label, even when every enum constant is covered.
  2. BAn enum switch expression may omit `default` when it covers every enum constant, and adding a new constant later can make it non-exhaustive.
  3. CA switch expression cannot use enum constants as case labels.
  4. DA switch expression over an enum always returns `null` if no `default` label is present.
Show answerCorrect answer: B

For 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.

Question 4

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(); ```

  1. A1
  2. B2
  3. C3
  4. DThe code throws an exception when adding the repeated value.
Show answerCorrect answer: B

A `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.

Question 5

What is printed by this code? `String text = "cat"; System.out.println(text.length());`

  1. A2
  2. B3
  3. C4
  4. DThe code does not compile
Show answerCorrect answer: B

The string `"cat"` contains three characters, and `String.length()` returns the number of characters in the string.

Question 6

Which declaration correctly creates a `LocalDate` for January 2, 2024?

  1. A`LocalDate date = new LocalDate(2024, 1, 2);`
  2. B`LocalDate date = LocalDate.of(2024, 1, 2);`
  3. C`LocalDate date = LocalDate.parse(2024, 1, 2);`
  4. D`LocalDate date = LocalDate.create(2024, 1, 2);`
Show answerCorrect 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.

Question 7

Which statement about a `static` field in Java is correct?

  1. AEach instance always has its own separate copy of the field.
  2. BThe field can be accessed only from a constructor.
  3. CThe field belongs to the class rather than to each individual instance.
  4. DThe field cannot be assigned a value.
Show answerCorrect answer: C

A 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.
Official sourceOfficial exam page ↗