Register now or log in to join your professional community.
public class BoolTest { public static void main(String [] args) { Boolean b1 = new Boolean("false"); boolean b2; b2 = b1.booleanValue(); if (!b2) { b2 = true; System.out.print("x "); } if (b1 & b2) /* Line13 */ { System.out.print("y "); } System.out.println("z"); } }
the output will X Z
if(!b2) means If(!false)=> if(True) => print x
now, b1=false, b2=true
line13: if(b1 &b2) => if(false & true) => false , so it skips if condition
print z .
Output: xz
xz