What will be the output of the program

import java.util.Formatter;

public class Formatting {
    public static void main(String[] args) {
        Formatter formatter = new Formatter();
        System.out.println(
            formatter.format("%b %b %b %b %b", 
                true, null, "false",  new Boolean("false"), 0)
        );
    }
}
Explanation
For "%b" if the argument is null, then the result is "false". If argument is a boolean or Boolean, then the result is the string returned by String.valueOf(). Otherwise, the result is "true".
Java
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback