Java中的布尔值和布尔值有什么区别?

What#39;s the difference between boolean and Boolean in Java?(Java中的布尔值和布尔值有什么区别?)

本文介绍了Java中的布尔值和布尔值有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解 Java 中 Booleanboolean 类型之间的区别,特别是它们与 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中的布尔值和布尔值有什么区别?

基础教程推荐