what have you not understood in above program? i have inserted to SOP's to make it clear for you. b is true and c is false, so when you use or shortcut or operator then it will see only true for you and in next condition it will find && shortcut operator of variable d which is also true. so e is assigned value true.
public class BoolTest { public static void main(String[] args) {
Boolean b = new Boolean("TRue"); Boolean c = new Boolean("Null"); boolean d = true; System.out.println(b); //here System.out.println(c);//here
Boolean e = (b||c)&&d; //result System.out.println(e); }
javadoc says - public Boolean(String s) Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true". Otherwise, allocate a Boolean object representing the value false.
According to the constructor definition line 1 gives "true" and line 2 gives "false".
MooN
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?
a bit of art, as a gift, that will fit in a stocking