⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testconst.java.orig

📁 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 + -