class s implements Runnable{
int x=0,y=0;
synchronized void addX(){x++; }
synchronized void addY(){y++; }
void addXY(){x++;y++;}
boolean check() { return (x>y)? true:false
public void run()
{
////
System.out.println(check()); }
public static void main(
String args[])
{ s run=new s();
Thread t1=new Thread(run);
Thread t2=new Thread(run);
t1.start();
t2.start();
}
}
If this methods are called in which order the check will return true?
a:Select all that apply
b:call addX() and addY() simultaneously for number of times in run()
c:call addY() and addX() simultaneously for number of times in run()
d:all addXY() for number of times in run()
Ans:B,C
i don't understand the question,who can explain it in detailed.