I think the problem you have is with the "true" part which is get printed.When you try to convert something in to boolean if it is false it returns false .Any other occurrences returns true value .So here second argument 654 is convert to a boolean value and returns a true .I suggest you to read the printf and Formatter API . And K&B have good examples on these matters.
[Bsc in Computer Science and Engineering] [SCJP 80%][BCS certificate level]
Joined: Feb 01, 2007
Thanks for the Clarification, But I have the similar code using teh formatter class as given below
it prints the output as true false but I am expecting it to be false false
Joined: Aug 08, 2009
This is the exact thing I explained earlier .You can pass a string value to Boolean constructor and it doesn't check for Case sensitiveness. Whether you pass TRuETRUE or true it makes a boolean Wrapper object of true value.
printf only returns false if you convert a boolean false value to a boolean.Here what you pass is a String object ("FAlse").Whether you change it to "false" it still returns true, until you pass a boolean false value .