1. 常量(Constant):初始化(initialize)后不能在改变值!不会变动的值;

2. 所谓常量可以理解成一种特殊的变量,它的值被设定后,在程序运行过程中不允许被改变;

final 常量名 = 值;

final double PI = 3.14;

3. 常量名一般使用大写字符

  1. public class Demo07 {
  2. //修饰符不存在先后顺序
  3. //static final 的顺序先写哪个都可以
  4. static final double PI = 3.14;
  5. public static void main(String[] args) {
  6. System.out.println(PI);
  7. }
  8. }

image.png