Open In App
Related Articles

Boolean booleanValue() method in Java with examples

Improve Article
Improve
Save Article
Save
Like Article
Like

The booleanValue() method of Boolean Class is a built in method in java which is used to return the primitive boolean value of instance which is used to call the method booleanValue().

Syntax

BooleanObject.booleanValue()

Return Value: It returns a primitive boolean value.

Below are the examples to illustrate booleanValue() method:

Program 1:




class GeeksforGeeks {
  
    // Driver method
    public static void main(String[] args)
    {
  
        // creating a Boolean object.
        Boolean b = new Boolean(true);
  
        // get primitive data type using booleanValue()
        boolean value = b.booleanValue();
  
        // Print the result
        System.out.println(value);
    }
}


Output:

true

Example 2:




class GeeksforGeeks {
  
    // Driver method
    public static void main(String[] args)
    {
  
        // creating a Boolean object.
        Boolean b = new Boolean(false);
  
        // get primitive data type using booleanValue()
        boolean value = b.booleanValue();
  
        // Print the result
        System.out.println(value);
    }
}


Output:

false

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 01 Oct, 2018
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials