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.

Syntax:

Parameters:

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

Output:

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

Example 2

Output:

True/False:
Q. Tal Mahal is located in Delhi.
Ans true
1231
Incorrect. Because Taj Mahal is located in Agra.

Example 3

Output:

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

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA