Output of program: | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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"); } }

25th Mar 2018, 12:13 PM
Vartika Pahuja
Vartika Pahuja - avatar
4 Answers
+ 7
b2=b1!=b2 b1!=b2: false So, b2=false if (false){ //It will print the else statement and ignore if statement }
25th Mar 2018, 1:32 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 2
false
25th Mar 2018, 1:01 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 2
can you please explain?
25th Mar 2018, 1:16 PM
Vartika Pahuja
Vartika Pahuja - avatar
+ 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 .
25th Mar 2018, 1:28 PM
Farshaad Heydari
Farshaad Heydari - avatar