Boolean boo = new Boolean(true);

解决方案 »

  1.   

    class B{ 
    public static void main(String[] args){ 
    Boolean boo = new Boolean("True");
    if(boo.booleanValue())
    System.out.println("boo is "+boo);
    }
    }
      

  2.   

    Boolean 是java的原始数据类型boolean的外覆类,其主要目的是为了将相应的原始类型打造为对象。使用方法:
    //...
    boolean b = true;
    Boolean bln = new Boolean(b); //这样原始类型b就被包装到了对象bln之中
    if(bln.booleanValue()){ //将对象的值输出
        System.out.println("看到这个,马上给我分吧");
    }
    //...
      

  3.   

    还有一个问题,就是关于Boolean(boolean value)看你们的解释好象不象其他普通构造器的结构x(){}的形式,好象在程序中直接就Boolean x=new Boolean(boolean value)?
      

  4.   

    在编译时,比如编译Boolean Class.
    public class Boolean
    {
       public Booelan(boolean b)
       {
          .....
       }
    }在应用时,一般不再是这个Boolean.java文件,
    {
      ......
      Boolean B = new Boolean(true);
      ......
    }Boolean is a wrapping Class of primitive type boolean. We have to use an Object Class to wrap a primitive type because we're talking Object Oriented Programming.
    Also, think the Vector Class, or Stack, or ArrayList, or HashMap,
    they all take Objects only, not primitive types.
    If vec is a Vector: Vector vec = new Vector();
    and b is a boolean type variable: boolean b = true;
    It's wrong to do this: vec.add(b);
    One has to wrap it as this: vec.add(new Boolean(b));If you still can not understand, consider to change your career.