package something;import java.util.Arrays;/*** 测试数组* @author skywalker**/public class ArrayTest {@SuppressWarnings("unused")public static void main(String[] args) {int[] a1 = new int[2];int[] a2 = new int[3];int[][] a3 = new int[2][3];String[] a4 = new String[4];System.out.println(a1.getClass().getCanonicalName());//int[]System.out.println(a1.getClass() == a2.getClass());//trueSystem.out.println(Arrays.toString(a1));//因为基本类型不可以作为泛型的参数System.out.println(Arrays.asList(a2));//[[I@15db9742]System.out.println(Arrays.asList(a4));//可以实现System.out.println(a4);Object o1 = a1;//Object[] o2 = a1;编译不通过,因为int不是Object,但是为什么没有自动装箱Object o3 = a3;Object[] o4 = a3;}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。