The parseBoolean() method of Boolean class returns a Boolean value for the specified String argument. It returns true if and only if string’s value is equal to “true”, else it returns false.

Syntax:

public static boolean parseBoolean(String s)

Parameters:

The parameter ‘s’ represents the string value.

Return Value:

The parseBoolean() method returns the Boolean value represented by the string argument ‘s’.

  • It returns true, if and only if the string argument is equal (ignoring case) to the string “true”.
  • It returns false for any other argument other than true.

 Example 1:

Output:

Example 2:

Output:

Example 3:

Output:

Pin It on Pinterest

Share This