Strange toCharArray() behavior

前端 未结 4 1077
长情又很酷
长情又很酷 2021-01-20 03:29

I was experimenting with toCharArray() and found some strange behavior.

Suppose private static final char[] HEX_CHARS = \"0123456789abcdef\".toCha

4条回答
  •  悲哀的现实
    2021-01-20 04:31

    The strange output is the toString() of the char[] type. for some odd reason, java decided to have a useless default implementation of toString() on array types. try Arrays.toString(HEX_STRING) instead.

提交回复
热议问题