About Question enthuware.ocpjp.v7.2.1407 :
Posted: Thu May 08, 2014 4:48 pm
For the following code the word "done" is never printed.
/* */
Is there something wrong with the way that I am calling the method
doALotOfStuff();?
-----
I selected option c)
done will never be printed
because for the code above "done" is never printed.
Please confirm.
Code: Select all
public class MySecureClass
{
public synchronized void doALotOfStuff()
{
try
{
LINE1: Thread.sleep(10000);
}catch(Exception e){ }
}
public synchronized void doSmallStuff()
{
System.out.println("done");
}
public static void main(String args[]){
MySecureClass mySC = new MySecureClass();
mySC.doALotOfStuff();
}
}
Is there something wrong with the way that I am calling the method
doALotOfStuff();?
-----
I selected option c)
done will never be printed
because for the code above "done" is never printed.
Please confirm.