1.

What will be the output of the program?

class MyThread extends Thread { public static void main(String [] args) { MyThread t = new MyThread(); t.start(); System.out.print("one. "); t.start(); System.out.print("two. "); } public void run() { System.out.print("Thread "); }
}

A. Compilation fails
B. An exception occurs at runtime.
C. It prints "Thread one. Thread two."
D. The output cannot be determined.
Answer» C. It prints "Thread one. Thread two."


Discussion

No Comment Found

Related MCQs