Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8389747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:48:27+00:00 2026-06-09T18:48:27+00:00

The JavaBeans methods’ signature’s has to follow certain conventions such as set…/get… and such.

  • 0

The JavaBeans methods’ signature’s has to follow certain conventions such as set…/get… and such. They have a convention for is…for instance isEven() could be a method for an Integer class to test a boolean. But then I wonder why not has… is also a legal identifier since it makes sense to me to test what something has e.g. hasCar() for a Person class or likewise.

Do you understand my question? What do you think?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:48:28+00:00Added an answer on June 9, 2026 at 6:48 pm

    Well, the general convention is to use get... and set... and thus is... is just an exception for booleans. For is... the convention is easy: you need to return a boolean, can skip the getter and the corresponding setter will take a boolean parameter as well.

    A convention for has... would be more difficult: has... would return a boolean but you’d still need a getter and setter which deal with different types. Thus has... is no replacement for get... as opposed to is... and since that part of the JavaBeans convention normally only is about getters and setters has... doesn’t fit in there.

    From the JavaBeans spec:

    Properties are discrete, named attributes of a Java Bean…

    Properties show up in a number of ways:

    1. …
    2. Properties can be accessed programmatically by other components calling their getter
      and setter methods (see Section 7.1 below).
    3. …

    Any property being accessed using has... would not be persistent nor be accessed by its getter method.

    Example: if a person has a car property, you’d expect to have a getCar() accessor. hasCar() wouldn’t be an accessor since the derived property hasCar would need an accessor named getHasCar() or isHasCar(). If has was an accessor prefix, the property would have the conflicting name car.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an assignment to use JavaBeans to create an online Banking application. I
I have a field name varaince in a table set to type Number(20,3) in
How can I call javabeans methods inside javascript functions? I need with no success
I have written my first java applet and get errors when deploying it on
As far as I know, JavaBeans are the simple getter and setters methods of
Update: Oracle has confirmed this as a bug. Summary: Certain custom BeanInfo s and
I have an Entity/JSF Managed Bean Ticket that represents a helpdesk ticket. It has
I'm using JasperReports with JavaBeans (I need to print reports in a application that
I have a java program that will work with a variety of Java Beans.
I have a JavaBean that reads and processes an XML file. The XML file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.