final 关键字可以修饰变量,方法,类定义

  • 修饰基本类型,数值不可变
  • 修饰引用类型,引用不可变
  • 修饰方法,不允许继承类修改,private 方法都隐式指定为 final
  • 修饰类,不可被继承