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 Thread Lock Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread Lock Doubt" Watch "Thread Lock Doubt" New topic

Thread Lock Doubt


Joined: Jan 09, 2000
Posts: 24
hi everybody,
Anyone please clarify the following.
3.Which of the following statements about threading are true?
A)You can obtain mutually exclusive lock on methods that
extends thread or implements runnable.
B)You can only obtain mutually exclusive lock on methods that
extends thread or implements runnable
C)You can obtain lock on any of methods. --true
D)You can obtain mutually exclusive lock on any of methods.
suprising, nothing about synchronised is there in the options.
Another silly question, but i am confused.
4.Which cannot be used in declaring and initializing an automatic (method call)
A. Final
B. Public --false
C. Constants of non-primitive type
D. Inner class from other scopes
E. Initialized arrays(such as "{Hello", "Goodbye"})
Thanking all.
Harry Chawla
Ranch Hand

Joined: Jun 03, 2000
Posts: 97
Hi Sheriffs and Ranch hands
can somebody pls answer to this.

Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
I am assuming the question #3 is the one right answer (radio-button ) kind of question. Here, you will have to pick the most appropriate answer. I agree the answers confuse you, but remember they are also making sure you read all the answers first. Also, I felt the answer D is incomplete( and syntactically incorrect ! ). What you have chosen, ie., C seems to be the right answer. What is being examined here is not how you can synchronize a method, but what you can synchronize. That's why there is no mention of the synchronized keyword.
For question 4, again what you have chosen is the right answer. However, the question itself, IMO is incorrectly worded. Automatic variables are those which are declared within the scope of a method, but the question is using the word method call ... for some reason that I can't comprehend.
Hope this helps,

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
I agree. Here's the link:
subject: Thread Lock Doubt
It's not a secret anymore!