• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mikalai Zaikin notes error

 
Ranch Hand
Posts: 358
Firefox Browser Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On this page http://java.boot.by/scjp-tiger/ch01s04.html, the author wrote: For boolean instance variables you may provide a getter method named is... or has... that returns a boolean, that can be used conveniently in boolean expressions
JavaBeans standard doesn't supports "has" at all!
PS: Correct me if Im wrong.

EDIT by mw: Corrected html link.
[ March 01, 2007: Message edited by: marc weber ]
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes you are right.
If the property is a boolean, the getter method's prefix is either get or is.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure that Mikalai is taking JavaBeans into consideration here.
He's just saying that you may provide methods named such as is... or has... for convenience. Nothing stops you from doing it. For example, look at Iterator.hasNext() : a convenient way to return a boolean.
 
Faisal Ahmad
Ranch Hand
Posts: 358
Firefox Browser Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Satou kurinosuke:
I'm not sure that Mikalai is taking JavaBeans into consideration here.
He's just saying that you may provide methods named such as is... or has... for convenience. Nothing stops you from doing it. For example, look at Iterator.hasNext() : a convenient way to return a boolean.


Please check the website again. Look at the top..where the heading is written..
"Develop code that declares both static and non-static methods, and - if appropriate - use method names that adhere to the JavaBeans naming standards."
Did you notice JavaBeans?
 
reply
    Bookmark Topic Watch Topic
  • New Topic