Which is the better way to implement a enable/disable method in Java?
1:
private boolean flag;
public void enable(boolean enable) {
flag = enable;
}
2:
private boolean flag;
public void enable() {
flag = true;
}
public void disable() {
flag = false;
}
Are there better wayys to do it?
Aucun commentaire:
Enregistrer un commentaire