类型与类型转换

数据类型

  • Primitive

    • byte
    • short
    • int
    • long
    • float
    • double
    • boolean
    • char
  • Reference/Object

类型转换

类型转换分为自动类型转换(隐式)与强制类型转换(显式)。

// 应用于简单数据类型
short s = 1;
int n = s;

// 应用于对象
Son son = new Son();
Parent papa = (Parent)son;

See

results matching ""

    No results matching ""