Courseiva

1Z0-829 Practice Question: Handling Date, Time, Text, Numeric and Boolean Values

Which TWO of the following are valid ways to create a LocalDate object in Java 17?

⚠ Common exam trap

Oracle often tests the distinction between `LocalDate.from()` (which requires a `TemporalAccessor` with date fields) and `Instant` (which lacks date fields without a time-zone), leading candidates to incorrectly assume any temporal object can be converted directly.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

LocalDate.of(2023, Month.JANUARY, 15)

`LocalDate.of(int year, Month month, int dayOfMonth)` is a standard factory method that creates a `LocalDate` from explicit year, month, and day values. The `Month` enum provides type-safe month constants, making this a valid and commonly used approach.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • LocalDate.from(Instant.now())

    Why it's wrong here

    Cannot derive LocalDate from Instant directly.

  • LocalDate.of(2023, Month.JANUARY, 15)

    Why this is correct

    Valid overload with Month enum.

  • LocalDate.of(2023, 13, 1)

    Why it's wrong here

    Month 13 is invalid.

  • LocalDate.parse("2023-01-15")

    Why this is correct

    Valid ISO-8601 parse.

  • LocalDate.ofEpochDay("19375")

    Why it's wrong here

    ofEpochDay expects long, not String.

About these practice questions

Courseiva writes every 1Z0-829 question from scratch — 513 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.