直接输出数组名

public class t1 {
    public static void main (String []args){
int []a=new int []{1,2,3};
char []b=new char []{'a','b'};
        System.out.println(a);
        System.out.println(b);


    }
}

输出结果为:

[I@61dc03ce
ab

原因:

输出调用的方法不一样。

posted @ 2020-05-03 17:54  xsyz  阅读(555)  评论(0编辑  收藏  举报