Oracle 1Z0-808 Exam question no. 73

Q.– Given the code fragment: 

LocalDate datel = LocalDate.now(); 
LocalDate date2 = LocalDate.of (6, 20, 2014); 
LocalDate date3 = LocalDate.parse("2014-06-20", DateTimeFormatter. ISO_DATE); 
System.out.println("date1 = " + date1); 
System.out.println("date2 = " + date2); 
System.out.println("date3 = " + date3); 

Assume that the system date is June 20, 2014. 

What is the result? 

A) Compilation fails

B) date1 = 2014-06-20 
     date2 = 2014-06-20 
     date3 = 2014-06-20 

C) date1 = 06/20/2014 
     date2 = 2014-06-20 
     date3 = Jun 20, 2014 

D) An exception is thrown at runtime.


⧪ please give your answer in a comment section.

Post a Comment

3 Comments

  1. at line LocalDate date2 = LocalDate.of (6, 20, 2014);
    Exception in thread "main" java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 20

    Answer D

    ReplyDelete