"Java programming language type" 的定义是什么

What is the definition for a "Java programming language type"

在网上搜索时,我没有找到 "Java programming language type" 一词的定义。我在看Oracle's JEE tutorial:

的时候踩了好几次

有时我认为所有Java class都是表达式的意思,包括我自己定义的那些,有时我认为只有Java.[=17附带的那些=]

如果 "Java programming language type" 只是任何 Java class,为什么他们在这里使用这样的表达式?我也找到了"Java programming language class"这个词,但我认为这两个意思是一样的。

类型的完整正式定义是在 JLS 中定义的 link

基本上java有两种类型:

  • 基元
  • 参考资料

基元是:

  • 整数
  • 字节
  • 布尔值
  • 字符
  • 浮动

参考文献是:

所有其他定义适用于某些框架或库支持的类型。

与其将其作为一个术语来阅读,不如将其作为 "Java programming language" "type" 来阅读。所以,这不过是 Java 支持的所有类型。对于有效的 Java 类型,请阅读 JLS - §4.1. The Kinds of Types and Values.

现在,如果您阅读 "C programming language type",那么它又意味着 C 中的所有有效类型。

"Java programming language class" 表示 JPL 类。它与类型不同。

Sometimes I think all Java classes are meant by the expression, including those I define myself, sometimes I think only those that are shipped with Java.

If a "Java programming language type" is just any Java class, why do they use such an expression here? Also I found the term "Java programming language class", but I think these two things mean the same.

类,不管是你写的还是别人写的,都只是一种(子)类型

中所述,JLS 是您在术语方面的最佳选择:

  1. Types, Values, and Variables

The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types (§4.2) are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types (§4.3) are class types, interface types, and array types. There is also a special null type.

其实引用类型也包含类型变量:

4.3. Reference Types and Values

There are four kinds of reference types: class types (§8), interface types (§9), type variables (§4.4), and array types (§10).

这些已在 答案中列出(空类型除外)。