What#39;s the difference between boolean and Boolean in Java?(Java中的布尔值和布尔值有什么区别?)
问题描述
我想了解 Java 中 Boolean 和 boolean 类型之间的区别,特别是它们与 GWT 相关的区别.我知道这些方法不受支持,但如果可用,我想了解更多信息.
I would like to understand the difference between the Boolean and boolean types in Java, specifically as they relate to GWT.
I know that methods are not supported but I want more info if it is available.
推荐答案
我不确定 GWT 因素是否有影响,但总的来说:
I'm not sure if the GWT factor makes a difference but in general:
boolean 是 java 原始类型,而 Boolean 是包装布尔值的对象/引用类型
boolean is a java primitive type whereas Boolean is an object/reference type that wraps a boolean
像这样在基元和对象之间进行转换称为装箱/拆箱.
Converting between primitives and objects like this is known as boxing/unboxing.
这里有更多信息:
http://javaeye.wordpress.com/2008/06/17/boxing-and-unboxing-conversion/
你为什么问盒子?
http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html
http://www.javapractices.com/topic/TopicAction.do?id=197
这篇关于Java中的布尔值和布尔值有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Java中的布尔值和布尔值有什么区别?
基础教程推荐
- RabbitMQ:消息保持“未确认"; 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
