Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

public class ThreadDemo { static Thread laurel, hardy; public static void main(S

ID: 3660067 • Letter: P

Question

public class ThreadDemo { static Thread laurel, hardy; public static void main(String[] args) { laurel = new Thread() { public void run() { System.out.println("A"); try { hardy.sleep(1000); } catch (Exception e) { System.out.println("B"); } System.out.println("C"); } }; hardy = new Thread() { public void run() { System.out.println("D"); try { laurel.wait(); } catch (Exception e) { System.out.println("E"); } System.out.println("F"); } }; laurel.start(); hardy.start(); } } [Answer to next question by using above code: Which letters will eventually appear somewhere in the output? Why? (Choose all that apply.) 1. A 2. B 3. C 4. D 5. E 6. F 7. The answer cannot be reliably determined. 8. The sequence of the output cannot be reliably determined.

Explanation / Answer

A E