What will be the result of compilation and running the following code:

import java.util.Formatter;
public class Formating {
    static Formatter formatter = new Formatter();
    public static void main(String[] args) {
        System.out.print(
            formatter.format("%b %b %b",
                new Boolean(null), 
                new Boolean("bool"), 
                8
            )
        );
    }
}
Explanation
%b: Produces either "true" or "false" as returned by Boolean.toString(boolean). If the argument is null, then the result is "false". If the argument is a boolean or Boolean, then the result is the string returned by String.valueOf(). Otherwise, the result is "true". http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты