Need little help on understanding how starting index and substring works : <p>Here is my code</p>

<pre><code>public static void main(String[] args) {
    Scanner reader = new Scanner(System.in);

    System.out.print("Type a word: ");
    String userWord = reader.nextLine();

    System.out.print("Length of the first part: ");
    int userLength = Integer.parseInt(reader.nextLine());

    System.out.println("Result: " + userWord.substring(0, userLength));
}
</code></pre>

<p>Result: </p>

<pre><code>Type a word: hellothere
Length of the first part: 3
Result: hel
</code></pre>

<p>Starting index starts counting from 0 right? So shouldn't the result print "hell"? </p>

<p>0 = h</p>

<p>1 = e</p>

<p>2 = l</p>

<p>3 = l</p>
