Which of the following is true about the output? import java.util.concurrent.*; class MyTask implements Runnable { private int taskId; public MyTask(int id) { this.taskId = id; } public void run() { System.out.println(“Task ” + taskId + ” executed by ” + Thread.currentThread().getName()); try { Thread.sleep(100); } catch (InterruptedException e) {} } } public class Main { public static void main(String[] args) { ExecutorService executor = Executors.newFixedThreadPool(2); for (int i = 1; i
Blog
Which access specifier allows visibility only within the sam…
Which access specifier allows visibility only within the same package?
What will be the output of the following code? String s1 = “…
What will be the output of the following code? String s1 = “Java”; String s2 = new String(“Java”); System.out.println(s1 == s2);
What is the state of a thread after the start() method is ca…
What is the state of a thread after the start() method is called but before run() begins execution?
Which of the following will definitely cause a NotSerializab…
Which of the following will definitely cause a NotSerializableException at runtime?
Diseases that develop during the adult years partially resul…
Diseases that develop during the adult years partially result from:
Which of the following nutrition problems is the least commo…
Which of the following nutrition problems is the least common among young children?
The two leading causes of death among the elderly are heart…
The two leading causes of death among the elderly are heart disease and _____.
Chronic conditions with modifiable risk factors include whic…
Chronic conditions with modifiable risk factors include which of the following?
Most toddlers and children have adequate vitamin and mineral…
Most toddlers and children have adequate vitamin and mineral consumption except for sodium, zinc and iron.