码:

public static void main(String[] args) {           String[] arr ={"a","b","c"};           List<String> list = Arrays.asList(arr);           list.add("d");           list.add("e");

}

Run results:

Exception in thread "main" java.lang.UnsupportedOperationException at java.util.AbstractList.add(AbstractList.java:131) at java.util.AbstractList.add(AbstractList.java:91) at com.cn.test.main(test.java:11)

改方法: List arrayList = new ArrayList(a); For example:

public static void main(String[] args) { String[] arr ={"a","b","c"}; List<String> list = Arrays.asList(arr); List arrList = new ArrayList(list); arrList.add("d"); arrList.add("e"); }  

#: