Which of the following are true about the following program?
public class Main { public static void main(String args[]) { MyThread t1 = new MyThread("t1"); MyThread t2 = new MyThread("t2"); t1.start();//w w w . j a v a 2 s . com t2.start(); } } class MyThread extends Thread { public void displayOutput(String s) { System.out.println(s); } public void run() { for (int i = 0; i < 10; ++i) { try { sleep((long) (3000 * Math.random())); } catch (Exception ex) { } displayOutput(getName()); } } public MyThread(String s) { super(s); } }
D.
The output may vary because it is not synchronized.