013-003-008

Display Current Date with LocalDate

Easy

Problem Description

Display Date Fields with LocalDate

In this problem, you will read a year, month, and day from standard input, create a LocalDate using LocalDate.of(year, month, day), then retrieve each field with getYear(), getMonthValue(), and getDayOfMonth() and print them to standard output.

Input format:

year
month
day

Output format:

Year: <year>
Month: <month>
Day: <day>

Learning Objectives:

  • Create a java.time.LocalDate instance and call its basic methods
  • Retrieve individual date fields using getYear(), getMonthValue(), and getDayOfMonth()
  • Understand the basics of the Java 8+ date API

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up