This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes contradictory statements 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 "contradictory statements" Watch "contradictory statements" New topic
Author

contradictory statements

Saurabh V Vakil
Greenhorn

Joined: Jan 30, 2008
Posts: 14
In the SCJP Sun Certified Programmer for Java 5(Exam 310-055) Exam Study Guide, the two minute drill in the first chapter(Identifiers (Objective 1.3) )states that methods following the JavaBeans Standards must start with set, get, is, add or remove.
Question number 5 of the same chapter's self test asks us to identify method names that follow the JavaBeans standard :
A. addSize
B. getCust
C. deleteRep
D. isColorado
E. putDimensions

The answer given in the Self Test Answers says the answer is options B and D along with the explanation that 'add' is not standard JavaBeans name prefix.
Now isn't there a contradiction here???
Is 'add' a JavaBeans standard prefix or not?
Serg Masow
Ranch Hand

Joined: Dec 17, 2007
Posts: 49
Hi Saurabh,

there is no contradiction. The prefix add can also be used. But just add a listener. In such a case the method name must begin with add and ends with word "Listener" and have the same listener type as argument. So a valid method declaration can be:

public void addSomeListener(SomeListener ls);

please look into the K&B book on the page 9 (JavaBean Listener Naming Rules) for further explanation.

Serg


SCJP 6.0 [95%] OCP EJBD 6.0 [93%]
Saurabh V Vakil
Greenhorn

Joined: Jan 30, 2008
Posts: 14
Thanks for the reply Serg. I got the point.
Jitendra Jha
Ranch Hand

Joined: Jan 28, 2007
Posts: 91
And saurabh, be careful with this as you can expect questions based on this understanding on the actual exam


Jitendra
SCJP1.5
SCWCD1.5
Saurabh V Vakil
Greenhorn

Joined: Jan 30, 2008
Posts: 14
Originally posted by Jitendra Jha:
And saurabh, be careful with this as you can expect questions based on this understanding on the actual exam


Yes I will be. Thanks for the reply.
 
GeeCON Prague 2014
 
subject: contradictory statements