Boolean.valueOf(): This method is available in the java.lang.Boolean class of Java.
Syntax:
Boolean java.lang.Boolean.valueOf(boolean b)
This method takes one argument of type boolean as its parameter. This method returns a Boolean instance representing the specified boolean value.
Parameters: One parameter is required for this method.
b: a boolean value.
Returns: a Boolean instance representing b.
For Example:
Boolean.valueOf(true) = > It returns true.
Approach
Java
public class BooleanvalueOfBoolean {public static void main(String[] args) {boolean b = true;System.out.println(Boolean.valueOf(b));}}
Output:
true
No comments:
Post a Comment