There are two kinds of types in the Java programming language: primitive types (§4.2) and reference types (§4.3). There are, correspondingly, two kinds of data values that can be stored in variables, passed as arguments, returned by methods, and operated on: primitive values (§4.2) and reference values (§4.3).
还有第三种类型,也被称为null:
There is also a special null type, the type of the expression null (§3.10.7, §15.8.1), which has no name.
# 1 楼答案
它们内置于语言中:
int,long,float,double,char,byte,boolean,short
为了让人感到舒适,这种转换也有一些类别: 它们都在java中。朗套餐:
整型、长型、浮点型等
例如:
# 2 楼答案
它们不是类,因此它们不存在于任何包中
这就是Java的设计
基本类型包括boolean、byte、char、short、int、long、float和double(我想我没有错过任何正确的吗?:p)
它们在java下都有相应的包装器。例如,字节、字符、整数等
# 3 楼答案
请阅读此处的规范:http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.2
还有第三种类型,也被称为
null
:基元类型是特殊的数据类型,不属于任何包或类。尽管有相关的包装类型,例如整数、长、布尔等,它们被放在
java.lang
包中