Skip to content
Sharp

Java Threading · interview question

Which Java class would you use to create a fixed-size thread pool for virtual threads?

Multiple choiceMediumchapter-15-curatedpremiumjava-threadingvirtual-threads
Choose one answer
Answer and explanation

Correct answer

D. Executors.newVirtualThreadPerTaskExecutor()

Why

Executors.newVirtualThreadPerTaskExecutor() is a method specifically designed for scheduling tasks on virtual threads, making it suitable for managing a pool of virtual threads efficiently.

Test yourself on Java Threading

A free test with instant, explained results. No account needed.

Start free test
All Java Threading questions →