I have below code. I tried a lot but how can I simplify this to one line(without if-else):
public static void main(String[] args) {
boolean result;
boolean a = false;
boolean b = false;
boolean isEmpty = false;
if (a) {
result = isEmpty && !b;
System.out.println("if " + (isEmpty && !b));
} else {
System.out.println("else " + !b);
result = !b;
}
System.out.println(result);
}
Aucun commentaire:
Enregistrer un commentaire