What will be the output of the following code?

public class Test {
    int i = 10;
    public int hashCode() {
        return i;
    public static void main(String ... a) {
        System.out.println(String.format(" %1$b  ", new Boolean("fAlSe")) );
        System.out.println(String.format(" %1$H %2$s", new Test(), null ) );
Constructor Boolean(String) will always return false except when argument equals "true" ignoring case.
%1$H - will call (new Test()).hashCode() and show the result as hexadecimal string.

Follow CodeGalaxy

Mobile Beta

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