What result will be obtained for compilation and execution of this code:

public class Main {
    public static void main(String [] str) {
        Boolean b1 = new Boolean("false");                //1
        if (b1 = true) System.out.println("b1=" + b1);    //2

        boolean b2 = false;        
        if (b2 = true) System.out.println("b2=" + b2);    //3

        int i = 1;        
        if (i = 2) System.out.println("i=" + i);          //4
    }    
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes