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

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

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

Given:

java

ExecutorService service = Executors.newFixedThreadPool(2);

Runnable task = () -> System.out.println("Task is complete");

service.submit(task);

service.shutdown();

service.submit(task);

What happens when executing the given code fragment?


A.

It prints "Task is complete" once and throws an exception.


B.

It prints "Task is complete" twice and throws an exception.


C.

It exits normally without printing anything to the console.


D.

It prints "Task is complete" twice, then exits normally.


E.

It prints "Task is complete" once, then exits normally.


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.