What is the output of the following code?

Last Updated :
Discuss
Comments

What is the output of the following code?

Java
public synchronized void print() {
    System.out.println("Start");
    try { Thread.sleep(100); } catch (Exception e) {}
    System.out.println("End");
}

Will always print "Start" and "End" together

Will print "Start" only

Might throw InterruptedException

Prints "End" before "Start"

Share your thoughts in the comments