Question
class Output {
public static void main(String args[]) {
String str = "true";
boolean x = Boolean.valueOf(str);
System.out.print(x);
}
}
What is the output of this program?
class Output {
public static void main(String args[]) {
String str = "true";
boolean x = Boolean.valueOf(str);
System.out.print(x);
}
}
Answer: Option A
Was this answer helpful ?
valueOf() returns true if the specified string contains "true" in lower or uppercase
and false otherwise.
Output:
$ javac Output.java
$ java Output
true
Was this answer helpful ?
More Questions on This Topic :
Question 5.
Which of these class have only one field?
....
Submit Solution