更新时间:2023-10-11 08:07:04
字符串实现 CharSequence 界面。 CharSequence由String实现,但也有CharBuffer,Segment,StringBuffer,StringBuilder。
String implements the CharSequence interface. CharSequence is implemented by String, but also CharBuffer, Segment, StringBuffer, StringBuilder.
所以String []和CharSequence []基本相同。但是CharSequence是抽象,String是实现。
So a String[] and a CharSequence[] is essentially the same. But CharSequence is the abstraction, and String is the implementation.
顺便说一下,'[]'表示对象的数组。所以 String []
是一个字符串数组。而String本身就是一个字符数组。
By the way, '[]' denotes an array of objects. So String[]
is an array of strings. And String itself is an array of characters.