Boolean.getBoolean() in Java

Boolean.getBoolean(): This is available in the java.lang.Boolean class of Java.

Syntax:

boolean java.lang.Boolean.getBoolean(String name)

This method takes two arguments of type String as its parameters. This method returns true if and only if the system property named by the argument exists and is equal to, ignoring case, the string "true".

Parameters: One parameter is required for this method.

name: the system property name.

Returns: the boolean value of the system property.

Throws: SecurityException - for the same reasons as System.getProperty

For Example:

Boolean.getBoolean("Aryan") = > It returns false.

Approach

Java

public class BooleangetBoolean {
    public static void main(String[] args) {

        String name = "Aryan";

        System.out.println(Boolean.getBoolean(name));

    }
}

Output:

false

No comments:

Post a Comment