package socket; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ArrayToListDemo { public static void main(String[] args) { String [] array = {"one","two","three","four"}; Listlist = Arrays.asList(array); System.out.println(list); list.set(1, "2"); System.out.println(list); System.out.println("array:"+Arrays.toString(array)); //list.add("five"); List list2 = new ArrayList (list); //list2.addAll(list); list2.add("five"); System.out.println(list2); } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)