File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Threads" Watch "Threads" New topic


Shiaber Shaam
Ranch Hand

Joined: Jun 16, 2006
Posts: 252
Consider i have 2 methods in a class, 1 is synchronized and other is not. If Thread A acquires lock on an instance and executing the synchronized method, can Thread B execute the non synchronized method on the same instance?

Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3151

How about putting this situation into code?

Mohamed Sanaulla | My Blog
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

Yes, thread B can access the non-synchronized method, since the object's lock is not needed.

|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 448

Yes the non-synchronized method can be invoked. Infact another synchronized method which requires locking some other instance than the first method is also invokable at the same time by a different thread.

Java Experience
I agree. Here's the link:
subject: Threads
It's not a secret anymore!