File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

threads

 
preeti khane
Ranch Hand
Posts: 93
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can someone give me the correct answers and explanation
thank you
 
Reshma Shanbhag
Ranch Hand
Posts: 204
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess the answers are 1, 2 and 3.
The methods a(), b() and c() are synchronized. So any thread that is accessing one of the methods cannot access rest two untill it finishes with the first method in a given object of class Q7ed5. Every method takes care of incrementing as well as decrementing the variables too, hence the value of variable 'v' switches between 0 and 1.
If am wrong correct me.
[ April 03, 2003: Message edited by: Reshma Pai ]
[ April 03, 2003: Message edited by: Reshma Pai ]
 
preeti khane
Ranch Hand
Posts: 93
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer in the exam is only 1 and 2
 
Reshma Shanbhag
Ranch Hand
Posts: 204
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey i mistaked thinking that method c() is synchronized.. since it is not, thevalue of k.v cannot be predcited...
the Answer's 1 & 2 are right.. sorry for the mistake .
reshma
[ April 03, 2003: Message edited by: Reshma Pai ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic