Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Convert Boolean to boolean primitive example

  1. /*
  2.  * Convert Boolean to boolean primitive example. Program to convert Java
  3.  * Boolean object to boolean primitive data type.
  4.  */
  5.  
  6. public class BooleanToboolean {
  7.  
  8.  public static void main(String args[]){
  9.  
  10.   //new Boolean object
  11.   Boolean bObj = new Boolean("true");
  12.  
  13.   //to convert Boolean to boolean use booleanValue method of Boolean wrapper class
  14.   boolean b = bObj.booleanValue();
  15.  
  16.   System.out.println("Boolean converted to boolean: " + b);
  17.  
  18.  }
  19. }
No votes yet
Share this

Post new comment

2 + 15 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.