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

user496949 picture user496949 · Mar 16, 2011 · Viewed 171.7k times · Source

Eg.

boolean isCurrent = false;

What do you name its getter and setter?

Answer

Jigar Joshi picture Jigar Joshi · Mar 16, 2011

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