package Test;
import java.util.Arrays;
import java.util.List;
public class Test_17 {
public static void main(String args[]){
String[] arr = {"1","2","3","4","5"};
List list = Arrays.asList(arr);
System.out.println(list);
int[] num = {1,2,3,4,5};
list = Arrays.asList(num);
System.out.println(list);
System.out.println(num);//[I@544a5ab2
}
}
//[1, 2, 3, 4, 5]
//[[I@152b6651],这不是哈希值,这是内存地址。是数组在内存中的地址
打印一个对象默认的是调用toString()方法,没有重写的情况下打印的就是对象的地址。 |