new Boolean(null) will call the construcor :
public Boolean(String s) {
this(parseBoolean(s));
}
public static boolean parseBoolean(String s) {
return ((s != null) && s.equalsIgnoreCase("true"));
}
So the returned value will be false.
The answer is A
Correct answer is B. tested -> True null in console
Boolean[] x = new Boolean[2];
x[0] = new Boolean(Boolean.parseBoolean("true"));
x[1] = null;
System.out.println(x[0] + " " + x[1]);
by default anything else is a false.
private static boolean toBoolean(String name) {
return ((name != null) && name.equalsIgnoreCase("true"));
}
upvoted 2 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
v323rs
Highly Voted 4 years agoRdharma
Most Recent 7 months, 2 weeks agoVicky_65
10 months, 1 week agocarloswork
1 year, 3 months agoBhushahK
2 years, 9 months agothis_nickname
3 years, 6 months agoauroravismara
3 years, 7 months agolevilevi
3 years, 6 months agomete23
4 years agoletmein2
4 years, 5 months ago