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 contradictory statements 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 "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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: contradictory statements
 
Similar Threads
JavaBeans naming standard Question
A question in K&B book for SCJP 1.5
"add" is a Standard javabean prefix or not?
Doubt K&B chapter 1 javabean names
JavaBean standard question from Sierra's book