Oracle Java SE 21 Developer Professional 1z0-830 Question # 19 Topic 2 Discussion

Oracle Java SE 21 Developer Professional 1z0-830 Question # 19 Topic 2 Discussion

1z0-830 Exam Topic 2 Question 19 Discussion:
Question #: 19
Topic #: 2

Given:

java

Runnable task1 = () -> System.out.println("Executing Task-1");

Callable task2 = () -> {

System.out.println("Executing Task-2");

return "Task-2 Finish.";

};

ExecutorService execService = Executors.newCachedThreadPool();

// INSERT CODE HERE

execService.awaitTermination(3, TimeUnit.SECONDS);

execService.shutdownNow();

Which of the following statements, inserted in the code above, printsboth:

"Executing Task-2" and "Executing Task-1"?


A.

execService.call(task1);


B.

execService.call(task2);


C.

execService.execute(task1);


D.

execService.execute(task2);


E.

execService.run(task1);


F.

execService.run(task2);


G.

execService.submit(task1);


Get Premium 1z0-830 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.