java arrays 和arrayList 的區別
package com.vc;
import java.util.Arrays;
public class Demo05 {
public static void main(String[] args) {
int[] arr = {1,2,3,4,5};
System.out.println(Arrays.toString(arr));
}
}
public class Demo06 {
public static void main(String[] args) {
List<String> a = new ArrayList<String>();
a.add("123");
a.add("456");
a.add("789");
int size = a.size();
String[] array = (String[]) a.toArray(new String[size]);
System.out.println(array[0]);
List<String> arrayList = Arrays.asList(array);
System.out.println(arrayList.get(2));
}
}