主要的区别有
- boolean是基本数据类型,而Boolean是一个包装类
- boolean一般存在于栈空间中,而Boolean对象存在于堆空间中
- boolean有true和false两种值,Boolean除了有true和false之外,还有null
- 进行强制转换时,需要使用Boolean,例如
Boolean isLogin=(Boolean)session.getAttribute("isLogin");
//session.getAttribute()方法返回的是Object类型
主要的区别有
Boolean isLogin=(Boolean)session.getAttribute("isLogin");
//session.getAttribute()方法返回的是Object类型