📄 testconst.java.orig
字号:
public class TestConst{
final int x[ ]={1,2,3};
final NewConst y=new NewConst();
public static void main(String args[] ){
TestConst t=new TestConst( );
t.go( );
int[ ] x1=t.x;
System.out.println("The code with problem");
for(int i=0;i<x1.length;i++){
System.out.println(x1[i]);
}
NewConst x2=t.y;
System.out.println("The code without problem");
for(int i=0;i<x2.getConst().length;i++){
System.out.println(x2.getConst()[i]);
}
}
void go(){
x[0]=20;
y.getConst()[0]=20;
}
}
class NewConst{
private final int x[ ]={1,2,3};
public final int[ ] getConst( ){
int [] s=(int []) x.clone();
return(s);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -