Java: println with char array gives gibberish

前端 未结 5 1976
悲哀的现实
悲哀的现实 2020-12-10 01:04

Here\'s the problem. This code:

String a = \"0000\";
 System.out.println(a);
char[] b = a.toCharArray();
 System.out.println(b);

returns

5条回答
  •  一生所求
    2020-12-10 01:31

    System.out.println("char[] b: " + b);
    

    This is just like

    System.out.println(("char[] b: " + b.toString());
    

    You can look up "Object.toString()"

提交回复
热议问题