This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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).]
 
 
subject: Synchronized
 
Similar Threads
synchronized keywords in static methods
Interfaces?
DATASETS IN SERVLETS?
Synchronized Class
Static variable Question?