Example usage for java.lang Boolean Boolean

List of usage examples for java.lang Boolean Boolean

Introduction

In this page you can find the example usage for java.lang Boolean Boolean.

Prototype

@Deprecated(since = "9")
public Boolean(String s) 

Source Link

Document

Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true" .

Usage

From source file:Main.java

public static void main(String[] args) {

    Boolean blnObj1 = new Boolean(true);
    Boolean blnObj2 = new Boolean("false");
    System.out.println(blnObj1);/*w  ww  .  j  a  v  a 2s  . co m*/
    System.out.println(blnObj2);
}

From source file:Main.java

public static void main(String args[]) {
    Boolean b1 = new Boolean("TRUE");
    Boolean b2 = new Boolean("FALSE");
    System.out.println(b1.toString() + " or " + b2.toString());
    for (int j = 0; j < 16; ++j)
        System.out.print(Character.forDigit(j, 16));

    Integer i = new Integer(Integer.parseInt("ef", 16));
    Long l = new Long(Long.parseLong("abcd", 16));
    long m = l.longValue() * i.longValue();
    System.out.println(Long.toString(m, 8));
    System.out.println(Float.MIN_VALUE);
    System.out.println(Double.MAX_VALUE);
}

From source file:MainClass.java

public static void main(String[] args) {
    boolean b = true;
    Boolean b2 = new Boolean(b);
    System.out.println(b2.booleanValue());
}

From source file:WrappedClassApp.java

public static void main(String args[]) {
    Boolean b1 = new Boolean("TRUE");
    Boolean b2 = new Boolean("FALSE");
    System.out.println(b1.toString() + " or " + b2.toString());
    for (int j = 0; j < 16; ++j)
        System.out.print(Character.forDigit(j, 16));
    System.out.println();//from   w ww. j a  va2 s .  c  o m
    Integer i = new Integer(Integer.parseInt("ef", 16));
    Long l = new Long(Long.parseLong("abcd", 16));
    long m = l.longValue() * i.longValue();
    System.out.println(Long.toString(m, 8));
    System.out.println(Float.MIN_VALUE);
    System.out.println(Double.MAX_VALUE);
}

From source file:Main.java

public static void main(String[] args) {
    boolean b = true;
    // using constructor
    Boolean blnObj1 = new Boolean(b);
    // using valueOf method of Boolean class. 
    Boolean blnObj2 = Boolean.valueOf(b);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Boolean refBoolean = new Boolean(true);
    boolean bool = refBoolean.booleanValue();

    Byte refByte = new Byte((byte) 123);
    byte b = refByte.byteValue();

    Character refChar = new Character('x');
    char c = refChar.charValue();

    Short refShort = new Short((short) 123);
    short s = refShort.shortValue();

    Integer refInt = new Integer(123);
    int i = refInt.intValue();

    Long refLong = new Long(123L);
    long l = refLong.longValue();

    Float refFloat = new Float(12.3F);
    float f = refFloat.floatValue();

    Double refDouble = new Double(12.3D);
    double d = refDouble.doubleValue();
}

From source file:Main.java

public static void main(String[] args) {
    // Using constructors
    Boolean b1True = new Boolean(true);
    Boolean b2True = new Boolean("true");
    Boolean b3True = new Boolean("tRuE");
    Boolean b4False = new Boolean("false");
    Boolean b5False = new Boolean("how  is this"); // false

    // Using the factory methods
    Boolean b6True = Boolean.valueOf(true);
    Boolean b7True = Boolean.valueOf("true");
    Boolean b8True = Boolean.valueOf("tRuE");
    Boolean b9False = Boolean.valueOf("false");
    Boolean b10False = Boolean.valueOf("how is this"); // false

    // Getting a boolean value from a Boolean object
    boolean bbTrue = b8True.booleanValue();

    boolean bTrue = Boolean.parseBoolean("true");
    boolean bFalse = Boolean.parseBoolean("This string evaluates to false");

    Boolean bcTrue = Boolean.TRUE;
    Boolean bcFalse = Boolean.FALSE;

    System.out.println("bcTrue = " + bcTrue);
    System.out.println("bcFalse = " + bcFalse);
}

From source file:Main.java

public static void main(String[] args) {
    String str = "false";
    // Convert using constructor
    Boolean blnObj1 = new Boolean(str);
    System.out.println(blnObj1);/*from   w ww  .j  ava  2 s .  co m*/

    // Use valueOf method of Boolean class. This is a static method.
    Boolean blnObj2 = Boolean.valueOf(str);
    System.out.println(blnObj2);
}

From source file:Main.java

public static void main(String[] args) {
    boolean theValue = true;

    //boolean to String conversion
    String theValueAsString = new Boolean(theValue).toString();

    System.out.println(theValueAsString);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Object[][] data = { { "A", new Integer(3), new Double(7.23), new Boolean(true) },
            { "J", new Integer(2), new Double(4.64), new Boolean(false) },
            { "S", new Integer(1), new Double(8.81), new Boolean(true) } };

    String[] columns = { "Col", "Col", "Col", "Col" };

    JTable table = new JTable(data, columns);
    JScrollPane scroll = new JScrollPane(table);

    JFrame f = new JFrame();
    f.setContentPane(scroll);//from w  w w.  java  2s.  c  o  m
    f.pack();

    int x = (int) table.getTableHeader().getSize().getWidth();
    int y = (int) table.getTableHeader().getSize().getHeight() + (int) table.getSize().getHeight();

    BufferedImage bi = new BufferedImage((int) x, (int) y, BufferedImage.TYPE_INT_RGB);

    Graphics g = bi.createGraphics();
    table.getTableHeader().paint(g);
    g.translate(0, table.getTableHeader().getHeight());
    table.paint(g);
    g.dispose();

    JOptionPane.showMessageDialog(null, new JLabel(new ImageIcon(bi)));
    ImageIO.write(bi, "png", new File("c:/Java_Dev/table.png"));

    System.exit(0);
}