+ 2
Output of program:
package com.abc; public class bool { public static void main(String args[]) { boolean bl = false; boolean b2 = false; if (b2 = bl!=b2) System.out.println("true"); else System.out.println("false"); } }
4 Answers
+ 7
b2=b1!=b2
b1!=b2: false
So, b2=false
if (false){
//It will print the else statement and ignore if statement
}
+ 2
false
+ 2
can you please explain?
+ 2
b1 and b2 are equal, so the result of b1!= b2. is false .
the the result of this comparison(false). is assigned to b2 . so b2 becomes (remains)false .