0
What's the difference between subsequence(first, last) and substring (first, last) .
I didn't find any difference when I compiled it
4 Antworten
+ 3
CharSequence is an interface and String is a class.
String, StringBuilder, StringBuffer, CharBuffer and Segment implements this interface.
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/lang/CharSequence.html
You can also read here about the difference: https://www.baeldung.com/java-char-sequence-string
+ 2
subSequence returns CharSequence and substring returns a String.
https://stackoverflow.com/questions/26560440/difference-between-subsequence-and-substring-methods-in-java-string-class
+ 2
Read the 1st answer on that link.
It is explained pretty well.
0
Can u make it clear I didn't get it :( Avinesh