I have a little confusion regarding the difference between subSequence method and subString method in Java String class. I read the article What is the difference between String.subString() and String.subSequence() which was been answered to this question but I have a little confusion, the article mentioned "Its read only in the sense that you can't change the chars within the CharSequence without instantiating a new instance of a CharSequence".
But when I tried with the following example it
String string = "Hello";
CharSequence subSequence = string.subSequence(0, 5);
System.out.println(subSequence.subSequence(1, 4));
subSequence = subSequence.subSequence(1, 4);
System.out.println(subSequence);
it prints
ell
ell
I do not know whether I have understood it correctly. Can you please help me to clarify this and please tell me the difference between subString and subSequence with an example
thanks a lot