What is the result of the following program execution?

public class A {
    public static void main(String[] args) {
        Boolean b1 = true;
        Boolean b2 = new Boolean("/false");
        String s1 = "" + 1 + '+' + 1 + '=' + (1 + 1) + " is ";
        String s2 = s1 + b1 + '/' + b2;
        System.out.println(s2);
    }
}
Explanation
Boolean constructor from String parameter
Boolean(String s)
will allocate true if the parameter equals ignore case to "true" and will allocate false otherwise.
(1+1) will be first summed and then converted to String.

Follow CodeGalaxy

Mobile Beta

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