package test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class FinalDemo {
@SuppressWarnings("unchecked")
public void t(){
List<String> list= new ArrayList<String>();
String[] strs=new String[10];
f(list); //同一个对象List 然后给别处加add
ff(strs);
System.out.println(list);
System.out.println(new ArrayList(Arrays.asList(strs)));
}
//不用返回当前集合
public void f(List<String> list){
list.add("1");
list.add("2");
list.add("3");
list.add("4");
list.add("5");
list.add("6");
}
public void ff(String[] strs){
strs[0]="aaa1";
strs[1]="aaa2";
strs[2]="aaa3";
strs[3]="aaa4";
strs[4]="aaa5";
}
public static void main(String[] args) {
FinalDemo ff=new FinalDemo();
ff.t();
}
}