What will happen after the following code is compiled and executed?

public class Main implements Runnable {
    public void run() {
        System.out.println("Hello");
        Thread.currentThread().sleep(100);        
    }        
    public static void main(String... args) throws InterruptedException {
        new Thread(new Main()).start();
    }
}
Explanation
Code will not compile.
InterruptedException should be processed in the run() method.
Java
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback