query regarding Boolean.getBoolean()
I have a field say "a" which is of Type String
But when I do getBoolean of tht String(which has value true), i still get as "false"
String a = "true";
System.out.println("get Boolean of a : " + Boolean.getBoolean(a));
get Boolean of a : false
My query is , even if the String a has value "true", why is the getBoolean returning false?
> > My query is , even if the String a has value "true",> why is the getBoolean returning false?Because that method doesn't do anything like you think it does which is easily descernible from looking at the API Javadocs.
For ur required result
Try this one
System.setProperty("a","true");
System.out.println("get Boolean of a : " + Boolean.getBoolean("a"));
Plz Note that
It returns true if and only if the system property named by the argument exists