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();
            formatter.format("%b %b %b %b %b", 
                true, null, "false",  new Boolean("false"), 0)
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".

Follow CodeGalaxy

Mobile Beta

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