What will be the output of this program?
class TestThread extends Thread {
public void run() {
try {
Thread.sleep(1000);
System.out.println("Thread Running");
} catch (InterruptedException e) {
System.out.println("Interrupted");
}
}
public static void main(String[] args) {
TestThread t = new TestThread();
t.start();
t.interrupt();
}
}
Thread Running
Interrupted
No Output
Both A and B, depending on timing
This question is part of this quiz :
Java Thread Methods and Daemon Threads