Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

public void foo( boolean a, boolean b){ if ( a ) { System.out.println( \"A\" );

ID: 3637100 • Letter: P

Question

public void foo( boolean a, boolean b){     if( a )     {        System.out.println("A"); /* Line 5 */    }     else if(a && b) /* Line 7 */    {         System.out.println( "A && B");     }     else /* Line 11 */    {         if ( !b )         {            System.out.println( "notB") ;        }         else         {            System.out.println( "ELSE" ) ;         }     } }
A. If a is true and b is true then the output is "A && B" B. If a is true and b is false then the output is "notB" C. If a is false and b is true then the output is "ELSE" D. If a is false and b is false then the output is "ELSE" A. If a is true and b is true then the output is "A && B" B. If a is true and b is false then the output is "notB" C. If a is false and b is true then the output is "ELSE" D. If a is false and b is false then the output is "ELSE"

Explanation / Answer

c