What is the output of the following code?
import java.time.LocalDate; import java.time.format.DateTimeFormatter; public class Main { public static void main(String[] args) { LocalDate date = LocalDate.parse("2018-04-30", DateTimeFormatter.ISO_LOCAL_DATE); date.plusDays(2);/*from www . j a v a 2s . c o m*/ date.plusHours(3); System.out.println(date.getYear() + " " + date.getMonth() + " " + date.getDayOfMonth()); } }
D.
A LocalDate does not have a time element.
Therefore, it has no method to add hours and the code does not compile.