View Single Post
  #1 (permalink)  
Old 09-18-2008, 09:57 AM
abhinav_jain09 abhinav_jain09 is offline
Member
 
Join Date: Sep 2008
Posts: 4
abhinav_jain09 is on a distinguished road
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
Attached Files
File Type: txt java_question.txt (5.1 KB, 3 views)

Last edited by abhinav_jain09 : 09-18-2008 at 10:29 AM.
Reply With Quote
Sponsored Links