Sail E0 Webinar
Question


What is the output of this program?


class Output {
public static void main(String args[]) {
String x = Boolean.toString(false);
}
}
Options:
A .  true
B .  false
C .  System Dependent
D .  Compilation Error
Answer: Option B

toString() Returns a String object representing the specified boolean. If the specified 

boolean is true, then the string "true" will be returned, otherwise the string "false" will 

be returned
Output:
$ javac Output.java
$ java Output
false



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers