The valueOf() method of Java Boolean class returns a Boolean object representing the given Boolean or String value. It returns true, if the specified Boolean or string object is true else it returns false.

Syntax

  1. public static Boolean valueOf(String s)
  2. public static Boolean valueOf(boolean b)

Parameters

The parameters ‘b’ and‘s’ represents a Boolean and a String value.

Return Value

The valueOf() method returns a Boolean instance representing b or s.

Example 1

Output

Example 2

Output

Example 3

Output

Example 4

Output

Pin It on Pinterest

Share This