tg-me.com/topJavaQuizExplain/48
Create:
Last Update:
Last Update:
What is the output of the following code?
LocalDate date = LocalDate.parse("2018-04-30", DateTimeFormatter.ISO_LOCAL_
DATE);
date.plusDays(2);
date.plusHours(3);
System.out.println(date.getYear() + " " + date.getMonth() + " "
+ date.getDayOfMonth());
❌ A. 2018 APRIL 2
❌ B. 2018 APRIL 30
❌ C. 2018 MAY 2
✅ D. The code does not compile.
❌ E. A runtime exception is thrown.
Explanation:
A LocalDate does not have a time element. Therefore, it has no method to add hours and the code does not compile.
BY Explanations “Top Java Quiz Questions”
Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283
Share with your friend now:
tg-me.com/topJavaQuizExplain/48