Java Boolean parseBoolean() MethodThe parseBoolean() method of Boolean class returns the string argument as a Boolean. The value is returned true if the argument is equal to the string "true" otherwise, for null or any other string argument, it returns false. Syntax:Parameters:A String parameter s is passed. Return Value:The logicalXor() method returns the Boolean represented by the string argument.
Example 1Test it NowOutput: String value = false String hash code value = 97196323 Boolean value = false Boolean hash code value = 1237 Example 2Output: True/False: Q. Tal Mahal is located in Delhi. Ans true 1231 Incorrect. Because Taj Mahal is located in Agra. Example 3Output: Enter any String value : reema Boolean value is false. For any String other than true, parseBoolean() method will return false.
Next TopicJava Boolean
|