package study.stage2;
import java.util.*;
/**
* Created by Sandy.Liu on 2017/7/19.
*/
public class AslistTest {
public static void main(String[] args){
int intarray[] ={10,23,34,3,23,43};//定义一个整形数组
List intlist = Arrays.asList(intarray);//转换成列表。但是整个整形数组是作为一个对象存入到list里面的
for(Object o: intlist){
System.out.println(o.toString());//预期输出是一整个数组,但是实际输出的是一个引用 [I@1540e19d
}
System.out.println("*****************************");//我是分隔符
String sarray[] = {"sandy","wendy","candy","hindey"};//定义对象类型的数组
List<String> slist = Arrays.asList(sarray);//对象类型的数组能每一个元素都存储到列表里
for(String s: slist){
System.out.print(s+" ");//sandy wendy candy hindey
}
System.out.println();
System.out.println("*****************************");
Integer iarray[] = {1,2,3,1,45,65,45};//定义对象类型的数组
List<Integer> ilist = Arrays.asList(iarray);
for(int i: ilist){
System.out.print(i+" ");//1 2 3 1 45 65 45
}
System.out.println();
}
}