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

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.

Leave a Comment