How many lines of the following code snippet contain compilation errors?.
11: ScheduledExecutorService t = Executors
12: .newSingleThreadScheduledExecutor();
13: Future result = t.execute(System.out::println);
14: t.invokeAll(null);
15: t.scheduleAtFixedRate(() -> {return;}, 5, TimeUnit.MINUTES);
C.
Line 13 does not compile because the execute()
method has a return type of void, not Future.
Line 15 does not compile because scheduleAtFixedRate()
requires four arguments that include an initial delay and period value.
For these two reasons, Option C is the correct answer.