【Java开源代码栏目提醒】:本文主要为网学会员提供BooleanClass.java,希望对需要BooleanClass.java网友有所帮助,学习一下!
public class BooleanClass
{
public static void main(String[] args)
{
Boolean a=false; //定义boolean类型变量a
Boolean b=true;
String c="asd";
//输出该布尔值的 String 对象
System.out.println(a.toString());
//输出实例a与实例b进行比较值
System.out.println(a.compareTo(b));
//输出实例a与实例b进行比较值
System.out.println(a.equals(b));
//输出该 Boolean 对象的哈希码。
System.out.println(a.hashCode());
//输出一个用指定的字符串表示值的 Boolean 值。
System.out.println(b.valueOf(c));
//输出 Boolean 对象返回基本布尔值值。
System.out.println(b.booleanValue());
}
}