What is the difference between CharSequence[] and a String[]?

后端 未结 7 1360
野的像风
野的像风 2020-12-24 10:32

What is the difference between CharSequence[] and String[]?

7条回答
  •  醉梦人生
    2020-12-24 10:51

    String implements the CharSequence interface. CharSequence is implemented by String, but also CharBuffer, Segment, StringBuffer, StringBuilder.

    So a String[] and a CharSequence[] is essentially the same. But CharSequence is the abstraction, and String is the implementation.

    By the way, '[]' denotes an array of objects. So String[] is an array of strings. And String itself is an array of characters.

提交回复
热议问题