Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Programmer Certification (OCPJP)
Doubt in synchronized
Gayk Gevorkyan
Greenhorn
Posts: 26
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
class Parent { synchronized void f() { } } class Child extends Parent { void f() { } }
Will f() in Child be synchronized?
Thanks,
Henry Wong
author
Posts: 23959
142
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
For future reference, the
Thread
class has a holdsLock() method, which can be used to quickly write a
test
program to see for yourself.
But, to answer your question.... No. The f() method in the Child class will not be synchronized.
Henry
Books:
Java Threads, 3rd Edition
,
Jini in a Nutshell
, and
Java Gems (contributor)
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Deadlock scenario
Inheritance - weird behaviour ?
overriding and polymorphism
Overriding/overloading
Question on Super
More...