在Java中,有没有比简单的if-else更好的方法来否定布尔值?
if (theBoolean) {
theBoolean = false;
} else {
theBoolean = true;
}
在Java中,有没有比简单的if-else更好的方法来否定布尔值?
if (theBoolean) {
theBoolean = false;
} else {
theBoolean = true;
}
theBoolean = !theBoolean;