【JAVA】fina关键词

public class Cont {
    public static void main(String[] args) {
        // 只能使用 不能更改
        System.out.printf("常量" +  Constant.AGE);
        System.out.printf("NAME" +  Constant.NAME);
    }
}


class Constant{
    public static final int AGE = 22;
    public static final String NAME = "常量名称";
}

 

posted @ 2022-06-06 18:17  PythonNew_Mr.Wang  Views(40)  Comments(0)    收藏  举报