tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Java > Core > Boolean > Boolean Creation

Boolean Creation 

This example shows creating boolean objects from string literals. Any string literal other than TRUE (ignore case) will be treated as FALSE.

File Name  :  
com/bethecoder/tutorials/core/bool/BooleanTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.core.bool;

public class BooleanTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    System.out.println(new Boolean("TrUe"));  //true
    
    System.out.println(new Boolean("TreU"));  //false
    System.out.println(new Boolean(null));    //false
    System.out.println(new Boolean("false"))//false
  }

}
   

It gives the following output,
true
false
false
false


                    Print

   



Books Recommendation

 
 
bl  br