What is the result?

Given the code fragment:

Assume that the system date is June 20, 2014. What is the result?

A. Option A
B. Option B
C. Option C
D. Option D

Download Printable PDF. VALID exam to help you PASS.

4 thoughts on “What is the result?

  1. A
    public static void main(String[] args) {
    LocalDate date1= LocalDate.now();
    LocalDate date2 = LocalDate.of(2014,6,20);
    LocalDate date3= LocalDate.parse(“2014-06-20”, DateTimeFormatter.ISO_DATE);
    System.out.println(date1);
    System.out.println(date2);
    System.out.println(date3);

  2. Answer A:

    There is no reason for the compilation to fail or to get any exception. Code will look like as stated in A.

  3. Correct answer is A, it won’t throw a parse exception because 2014-06-20 in indeed in ISO format. Tested with netbeans

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.