day11--final关键字用于修饰成员变量
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.inmind.final01;
|
||||
/*
|
||||
final关键字用于修饰成员变量
|
||||
成员变量:类中方法外
|
||||
*/
|
||||
public class Demo04 {
|
||||
//成员变量
|
||||
final int i = 1;
|
||||
final int j;//可以通过构造方法,赋值
|
||||
|
||||
public Demo04(int j){
|
||||
this.j = j;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user