What will be the output of the following method with various values of a and b?
public void output(boolean a, boolean b) { if (a) { System.out.println("A"); } else if (a && b) { System.out.println("A && B"); } else { if (!b) { System.out.println("notB"); } else { System.out.println("ELSE"); } } }
If a is true and b is true, then the output is "A && B"
If a is true and b is false, then the output is "notB"
If a is false and b is true, then the output is "ELSE"
If a is false and b is false, then the output is "ELSE"