1
나는이 생성자가 :내가 가진 생성자로 매개 변수를 owerwrite하지 않으려면 어떻게해야합니까?
private static int list [] = new int[0];
public IntList (String[] elems){
this.list = new int[elems.length];
int j=0;
for(String i : elems){
this.list[j] = Integer.parseInt(i);
++j;
}
}
을 그리고 나는 새로운 IntList
를 정의하면 나는 원래 하나의 args
을 볼 수있는 것보다.
public static void myTest(IntList args){
String[] tmpIntList = {"21","22","23","24"};
IntList newIntListForTest = new IntList(tmpIntList);
/* for example, if I called myTest with {"1","2","3"},
and if I print args here then I see only 21,22,23,24*/
}
둘 모두를 보려면 어떻게해야합니까?