常量定义

常量:

1.常量:都用大写字母或大写字母与下划线定义P  、MAX_VALUE

2.变量:首字母小写和驼峰命名原则 lastNmae 、 theLastNmae

3.方法名:首字母小写和驼峰命名原则runRun()

4.类名:首字母大写和驼峰 Main 、GoodMan

 

public class Demo07 {
   static final double P = 3.14;
   public static void main(String[] args) {
       //常量用final定义,用大写字母表示

       //或者 final static double P = 3.14; 修饰符final 、 static 可不分先后顺序
       System.out.println(P);
  }
 

}




原文地址:https://www.cnblogs.com/XiaoWubeginning/p/14092029.html