基本数据类型vs对象数据类型
重载overload:
Some operations are overloaded in the sense that the same operation name is used for different types 同样的操作名可用于不同 的数据类型
静态类型检查vs动态类型检查
静态类型检查:
动态类型检查:
可变&不可变
不变性:
Immutable types are types whose values can never change once they have been created. 不变数据类型:一旦被创建,其值不能改变
Java also gives us immutable references: variables that are assigned once and never reassigned. 如果是变量(引用),也可以 是不变的:一旦确定其指向的内存对象,该“指向关系”就不能再被 改变
如果编译器无法确定final变量不会改变,就提示错误,这也是静态 类型检查的一部分。
![](https://img-blog.csdnimg.cn/direct/e06fee4440004e63a046bcbc91152042.png)
![](https://img-blog.csdnimg.cn/direct/f27de10121aa446db228caaa545fccdd.png)
绘制snapshot图
复杂的数据类型:数组和集合
Array:长度不可变
List:长度可变
Set:集合是包含零个或多个唯一对象的无序集合
Map:无序(键,值)