What is the output of the following code?
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"
This question is part of this quiz :
Java Synchronization Basics