This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes about synchronized keyword Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "about synchronized keyword" Watch "about synchronized keyword" New topic
Author

about synchronized keyword

Niu Xiuyuan
Ranch Hand

Joined: Jun 08, 2001
Posts: 68

is the test() function in Father class thread-safe?

Sun Certified Java Programmer<br />Sun Certified Web Component Developer
Rick Salsa
Ranch Hand

Joined: Jul 17, 2001
Posts: 173
I don't think it does because in the class Father, test() is overriden. I believe that you need the synchronized keyword still.
-rick
Ragu Sivaraman
Ranch Hand

Joined: Jul 20, 2001
Posts: 464
Originally posted by Niu Xiuyuan:
[B]
is the test() function in Father class thread-safe?[/B]


Synchronized dont participate in Overriding or any OO paradigm
So to make it thread-safe you need to do it at the each individual class
HIH
Ragu
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: about synchronized keyword
 
It's not a secret anymore!