Page 1 of 1

Which two code fragments will execute the method doStuff() in a separate thread? (Choose two.)

Posted: Sun Jun 11, 2023 4:01 pm
by answerhappygod
Which two code fragments will execute the method doStuff() in a separate thread? (Choose two.)

A. new Thread() { public void start() { doStuff(); } };
B. new Thread() { public void run() { doStuff(); } };
C. new Thread(new Runnable() { public void run() { doStuff(); } }).start();
D. new Thread() { public void start() { doStuff(); } }.run(); E. new Thread(new Runnable() { public void run() { doStuff(); } }).run(); F. new Thread() { public void run() { doStuff(); } }.start();