final关键字修饰
在Java中,final关键字可以用来修饰类、方法和变量(包括成员变量和局部变量)。
具体的内容百度都有,这里不做具体说明,以下为正文
使用final修饰的类型数组
package cn.tedu.xml;
import java.util.Arrays;
/**
* @author "孤影"
* 2019年10月16日
* 下午7:10:29
*/
public class Test123456789 {
public static void main(String[] args) {
final String[] a = {"1","2","3","4","5","6","7","8","9"};
a[0] = "0";
System.out.println(Arrays.toString(a));
}
}
以下为代码运行的结果
[0, 2, 3, 4, 5, 6, 7, 8, 9]