*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes locks 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 "locks" Watch "locks" New topic
Author

locks

josephine chen
Ranch Hand

Joined: Oct 29, 2002
Posts: 216
check my answers
Which of the following have locks
only threads //t
classes have locks //t when u have sync methods
primitive types have locks //f
only runnable objects //t
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
only threads //only makes the ans NO. (threads also have locks since all objects have locks)
classes have locks //t when u have sync static methods
primitive types have locks //f
only runnable objects //t NO[/b]
maha anna

[This message has been edited by maha anna (edited February 20, 2000).]
[This message has been edited by maha anna (edited February 20, 2000).]
josephine chen
Ranch Hand

Joined: Oct 29, 2002
Posts: 216
as such runnable obj have locks becoz he said only
it is no
Am i right mahaAnna!!!
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
yes Shan. your reason is right.
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1844
Hi maha,
1)only threads //only makes the ans NO. (threads also have locks since all objects have locks)
2)only runnable objects //t NO[/b]
could you clarify on the above two points
Marcela Blei
Ranch Hand

Joined: Jun 28, 2000
Posts: 477
A field declared volatile isn�t locked?
I read from the JLS: a thread must reconcile its working copy of the field with the master copy every time it accesses the variable.
This means lock or a behavior like lock, isn�t it?
Savithri Devaraj
Ranch Hand

Joined: Jun 26, 2000
Posts: 103
Originally posted by maha anna:
only threads //[b]only makes the ans NO. (threads also have locks since all objects have locks)
classes have locks //t when u have sync static methods
Why static?
primitive types have locks //f
only runnable objects //t NO[/b]
maha anna

[This message has been edited by maha anna (edited February 20, 2000).]
[This message has been edited by maha anna (edited February 20, 2000).][/B]

Is n't it that all objects can have locks ? Primitives are not objects, hence can't be locked.
Savithri
 
 
subject: locks
 
Similar Threads
Question from Marcus Green Exam
locks ?
NX: Design review
Regarding Join method in Threads
Food for thought question (Threads related)