OCA Java SE 8 Core Java APIs - OCA Mock Question Core Java APIs 2-4








Question

What is the output of the following code?

public class Main{
   public static void main(String[] argv){
      LocalDate date = LocalDate.of(2016, Month.APRIL, 40); 
      System.out.println(date.getYear() + " " 
        + date.getMonth() + " " + date.getDayOfMonth()); 
   }
}
  1. 2016 APRIL 4
  2. 2016 APRIL 30
  3. 2016 MAY 10
  4. Another date.
  5. The code does not compile.
  6. A runtime exception is thrown.




Answer



F.

Note

40th day in April is not valid.