Javatpoint Logo
Javatpoint Logo

Java Boolean parseBoolean() Method

The 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.



A String parameter s is passed.

Return Value:

The logicalXor() method returns the Boolean represented by the string argument.

  • It returns true, if the string argument is not null and is equal (ignoring case) to the string "true".
  • It returns false for null for any other argument other than true.

Example 1

Test it Now


String value = false
String hash code value = 97196323
Boolean value = false
Boolean hash code value = 1237

Example 2


Q. Tal Mahal is located in Delhi.
Ans true
Incorrect. Because Taj Mahal is located in Agra.

Example 3


Enter any String value : reema
Boolean value is false.

For any String other than true, parseBoolean() method will return false.

Next TopicJava Boolean

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA