What is the result of executing the following fragment of code:.
boolean b1 = false; int i1 = 2; int i2 = 3; if (b1 = i1 == i2){ System.out.println ("true"); } else{ System.out.println ("false"); }
Select 1 option.
Correct Option is : C
All an if statement needs is a boolean.
Now i 1 == i2 returns false which is a boolean and since b 1 = false is an expression and every expression has a return value, it returns false which is again a boolean.
Therefore, in this case, the else condition will be executed.