直接输出数组名

Posted xsyz

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了直接输出数组名相关的知识,希望对你有一定的参考价值。

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

原因:

技术图片

输出调用的方法不一样。

以上是关于直接输出数组名的主要内容,如果未能解决你的问题,请参考以下文章