The Java synchronized keyword is important to safety because of which of the following: (a) It allows two different methods to execute in parallel lock-step (b) It prevents multiple developers from simultaneously writing the same block of code (c) It allows classes to be loaded as soon as the JRE starts (d) It prevents multiple threads from accessing a block of code at the same time (e) It prevents unauthenticated access to asynchronous libraries Which two can be used to define a new thread class? A. Extend class Thread and override its run() method B. Extend interface Runnable and override its start() method C. Implement class Thread and implement its call() method D. Implement interface Runnable and implement its run() method E. Implement class Thread and implement its start() method (a) B and E (b) A and D (c) D and E (d) A and C (e) C and D Which of the following statements will you use, to allow the current thread to wait for the normal completion of another thread, T? (a) T.yield() (b) T.join() (c) T.interrupt() (d) T.cancel() (e) T.sleep() Consider the Java program defined by the following class: public class XY extends Thread { public XY(String name) { super(name); } public void run() { printer.write(getName()); } public static Printer printer; public static class Printer { public synchronized void write(String n) { System.out.format("%s", n); System.out.format("%s", n); } } public static void main(String[] args) { printer = new Printer(); new XY("X").start(); new XY("Y").start(); } } Consider the following strings: A. XXYY B. YYXX C. XYYX D. YXXY Which of the above strings can be printed by running this program? (a) Just A (b) Any of A or B (c) Just C (d) Any of C or D (e) Any of A, B, C or D Consider the Java program defined by the following class: public class XY2 extends Thread { public XY2(String name) { super(name); printer = new Printer(); } public void run() { printer.write(getName()); } public Printer printer; public static class Printer { public synchronized void write(String n) { System.out.format("%s", n); System.out.format("%s", n); } } public static void main(String[] args) { new XY2("X").start(); new XY2("Y").start(); } } Consider the following strings: A. XXYY B. YYXX C. XYYX D. YXXY Which of the above strings can be printed by running this program? (a) Just A (b) Any of A or B (c) Just C (d) Any of C or D (e) Any of A, B, C or D