What is the difference between String.subString() and String.subSequence()

Using str.subSequence(begin, end) returns a CharSequence which is a read-only form of the string represented as a sequence of chars. For example: It’s read only in the sense that you can’t change the chars within the CharSequence without instantiating a new instance of a CharSequence. If you have to use str.subSequence(begin, end), you can cast the result to a String: and use all the normal String operators like subSequence … Read more