How many lines does this program print?
import java.time.*; public class Main { public static void main(String... nums) { LocalDate time = LocalDate.of(1, 11); while (time.getHour() < 1) { time.plusHours(1); /*from w ww. j ava 2 s. co m*/ System.out.println("in loop"); } } }
E.
The LocalDate class is only for day/month/year values.
It does not support time, so getHour()
and plusHours()
do not compile, making Option E the answer.