1.

What will be the output of the program?
 class MyThread extends Thread { MyThread() { System.out.print(" MyThread"); } public void run() { System.out.print(" bar"); } public void run(String s) { System.out.println(" baz"); } } public class TestThreads { public static void main (String [] args) { Thread t = new MyThread() { public void run() { System.out.println(" foo"); } }; t.start(); } } 

A. Foo
B. MyThread foo
C. MyThread bar
D. Foo bar
Answer» C. MyThread bar


Discussion

No Comment Found