Skip to content
CodeKruPro

Virtual threads in Java 21

QuizMedium-HardJava onlyAsked in: HCLTech

A virtual thread is a very cheap thread managed by the JVM instead of the operating system. Which statements about virtual threads in Java 21 are true? Pick all that apply.

  • They are a standard (final) feature in Java 21
  • Thread.ofVirtual().start(task) and Executors.newVirtualThreadPerTaskExecutor() create them
  • They make CPU-heavy calculations run faster
  • They remove the need for thread safety

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in