Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

re: SCJP for Java 5 Study Guide - JavaBeans Standard  RSS feed

 
Bill Fly
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 68 (Two-minute Drill) it states,JavaBeans methods must be named using camelCase, and depending on the method's purpose, must start with set, get, is, add, or remove. On page 78, Question 5 (Self-Test) says that answer A. addSize is incorrect. This is contradictory. How should that question be answered and why?
 
Rob Spoor
Sheriff
Posts: 21090
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As specified by the answer, add and remove can only be used for listeners: addActionListener, removeMouseListener, etc.
I do agree that the 2min drill is incomplete, but if you've read the entire chapter you would have seen that it is told, and you could've answered the question correctly.
 
Bill Fly
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob, add and remove are valid Listener method names per the JavaBean spec. Therefore, I think the answer for the question given by the book is incomplete. A is as good an answer as the othe two. Page 9 says For the exam, you need to know that the methods that are used to add or remove listeners from an event must also follow JavaBean naming standards.
[ October 16, 2007: Message edited by: Bill Fly ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!