boolean.class和Boolean.class有神马区别? 求解。。

boolean.class和Boolean.class有神马区别?

  1. boolean.class == Boolean.TYPE
  2. boolean是基本型,所以boolean.class.isPrimitive == true Boolean.class.isPrimitive == false

boolean 是原始类型即值类型 Boolean 是引用类型

boolean 布尔值基本类型,只是简单的保存值

Boolean 布尔值封装类型,是一个类,有许多方法可以调用

这方面的知识要去Google或找本书看基本知识,这个东西不是三言两语说得你明白的

class只是个属性。弄清楚boolean 是基本类型,而Boolean是对 boolean的封装类。

boolean 布尔值--java基本类型
Boolean 布尔值封装类型--java类
写代码的区别:
[code="java"]boolean value = true;
Boolean bl = new Boolean(value);[/code]

Boolean类中有多个封装的方法可以用;
就像int和Ieteger 一样。

那就请你采纳答案吧。呵呵

boolean.class直接报错