File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Synchronized 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 "Synchronized" Watch "Synchronized" New topic
Author

Synchronized

Allan Tan
Greenhorn

Joined: Oct 31, 2000
Posts: 7
Which of the following can be synchronized ?
methods?
member variables?
local variables?
code blocks?
static/non-static class?
Paul Caudle
Ranch Hand

Joined: Jun 08, 2000
Posts: 64
Hi Allan,
Methods and code blocks are the only items in your list that may be synchronized.
A method may be synchronized using it in the header as in:

and a block of code may be syncronized like the following:

I hope that helps,
Paul
[This message has been edited by Paul Caudle (edited November 06, 2000).]
[This message has been edited by Paul Caudle (edited November 06, 2000).]
 
jQuery in Action, 2nd edition
 
subject: Synchronized