string to char array, showing silly characters

后端 未结 4 1393
Happy的楠姐
Happy的楠姐 2021-01-24 12:51

It is a really simple question but I need an another eye to look at my code:

String strtr = \"iNo:\";
char[] queryNo = strtr.toCharArray();
System.out.println(qu         


        
4条回答
  •  借酒劲吻你
    2021-01-24 13:15

    That's how toString() is implemented for arrays.

    The [C denotes that is a char array, 177b4d3 is its hashcode.

    You may want to look at

    System.out.println(Arrays.toString(queryNo) + " =this is no");
    

    if you want to see your original String again, you need this:

    System.out.println((new String(queryNo)) + " =this is no");
    

提交回复
热议问题