class C {
public static void main(String args[]) {
Boolean b1 = Boolean.valueOf(true);//line 1
Boolean b2 = Boolean.valueOf(true);//line 2
Boolean b3 = Boolean.valueOf("TrUe");
Boolean b4 = Boolean.valueOf("tRuE");
System.out.println((b1==b2)+",");//line 3
System.out.println((b1.booleanValue()==b2.booleanValue())+",");
System.out.println((b3.equals(b4));
}
}
The output is - true,true,true
Follow is the source code of value(boolean b)
public static Boolean valueOf(boolean b) {
return (b ? TRUE : FALSE);
}
so it can take a boolean value as a argument.
And follow is the source code of value(String s)
public static Boolean valueOf(String s) {
return toBoolean(s) ? TRUE : FALSE;
}
And follow is the source of toBeelean(s)
private static boolean toBoolean(String name) {
return ((name != null) && name.equalsIgnoreCase("true"));
}
So we know that
that show when we compare the value "equalsIgnoreCase".
The answer is very clear!