Waiting Thread - Java Quiz Question


What will be the output of the following program?

public class WaitingThread{
    public static void main(String[] args) {
        CounterClass thread1 = new CounterClass(); // LINE A
        thread1.run();
    }
}
class CounterClass extends Thread {
    Thread t = new Thread();
    @Override
    public void run() {
        System.out.println("Thread entered.");
        try {
            t.wait();
        } catch (Exception e) {
            System.out.println("Thread Interrupted.");
        }
        System.out.println("Thread exiting.");
    }
}


A
Thread entered.
Thread exiting.
B
Thread entered.
C
Thread entered.
Thread Interrupted.
Thread exiting.
D
Output can not determined
E
Compilation Error or Runitme Error