package impotNew;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class test {
public static void main(String[] args) {
String[] strs = {"字符串0","字符串1","222222"};
ArrayList<String> alist =new ArrayList<String>(Arrays.asList(strs));
List<String> list= Arrays.asList(strs);
//Exception in thread "main" java.lang.UnsupportedOperationException
//list.add("song");
alist.add("song");
for(String str : alist){
System.out.print(str+" ");
}
System.out.println();
for(String str : list){
System.out.print(str+" ");
}
}
}
|