JAVA基础

fianl关键字

final修饰的变量初始化之后就不能更改

1
2
final Integer a=new Integer(10);
a=20; //a不可继续更改,错误写法

如果是一个引用,那么该引用指向的对象无法更改

1
2
3
4
Integer b=new Integer(10);
final Integer a=b;
a=new Integer(20); //错误写法
b++; //正确写法,这样是允许的

HashMap原理

hashMap冲撞等

Share