title: Difference between subSequence and subString methods in java String class
body: <p>I have a little confusion regarding the difference between subSequence method and subString method in Java String class. I read the article <a href="https://stackoverflow.com/questions/15505508/what-is-the-difference-between-string-substring-and-string-subsequence">What is the difference between String.subString() and String.subSequence()</a> which was been answered to this question but I have a little confusion, the article mentioned "<strong>Its read only in the sense that you can't change the chars within the CharSequence without instantiating a new instance of a CharSequence</strong>".</p>
  
  <p>But when I tried with the following example it</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>it prints<br>
  ell<br>
  ell</p>
  
  <p>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 <strong>subString and subSequence</strong> with an example</p>
  
  <p>thanks a lot</p>