|
challanging question
4
Public class Geo{
Public static void main(String [] args){
Geo g=new Geo();
final Object o1 = new Object();
fnal Object o2= new Object();
thread tx = new Thread (new Runnable(){
public void run(){
synchronized (o1){
synchronized (o2){
calc();
}
}
}
});
thread ty = new Thread (new Runnable(){
public void run(){
synchronized (o1){
synchronized (o2){
calc();
}
}
}
});
tx.start();
ty.start();
}
}
Which of the following about the geo.java program is true?
a) an exception can occur because of two threads.
b) The program contains invalid synchronize statements.
c) A deadlock situation can occur with the two threads.
d) The program is constructed in a way that will avoid deadlock.
Ans;-
also answer the question in attachment file
Last edited by abhinav_jain09 : 09-18-2008 at 10:29 AM.
|