|
Boolean Creation
This example shows creating boolean objects from string literals.
Any string literal other than TRUE (ignore case) will be treated as FALSE.
|
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
|
|