This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threads Synchronization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Threads Synchronization" Watch "Threads Synchronization" New topic
Author

Threads Synchronization

Balaji Bang
Ranch Hand

Joined: Apr 23, 2007
Posts: 180
Hi
I am talking about Devaka's Practice Exam-1 Q:72.

I made simple change in this..



In main method if the synchronized block has lock on object SynchEx that is 'ss' then synchronization works. if it is td then it will go and run method before it completes main. So in run() 'this' is the ss not 'td' ..

I understood like this. Am I Right???
Ruben Soto
Ranch Hand

Joined: Dec 16, 2008
Posts: 1032
Yes, you are correct.


All code in my posts, unless a source is explicitly mentioned, is my own.
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952
Yes, it is due to Thread.run() method in thread class.



It means for you:



SCJP 6
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads Synchronization