javacoding-stylenaming-conventionsjavabeans

For a boolean field, what is the naming convention for its getter/setter?


Eg.

boolean isCurrent = false;

What do you name its getter and setter?


Solution

  • Suppose you have

    boolean active;
    

    Accessors method would be

    public boolean isActive(){return this.active;}
    
    public void setActive(boolean active){this.active = active;}
    

    See Also