@@ -0,0 +1,858 @@
+package strings;%0A%0A/**%0A *%0A * String substring(int start)%0A * String substring(int start, int end) - startindex is inclusive, endindex is exclusive%0A *%0A */%0Apublic class StringMethods %7B%0A    public static void main(String%5B%5D args) %7B%0A%0A        // substring%0A        // startIndex is always inclusive%0A        // substring(int start)          -%3E inclusive start index till end%0A        // substring(int start, int end) -%3E inclusive start till exclusive end%0A        String s = %22hmm%22;%0A        System.out.println(s.substring(1, 2));  // prints just 'm'%0A        System.out.println(s.substring(1));     // prints 'mm'%0A        System.out.println(s.substring(1, 3));  // prints 'mm'%0A        System.out.println(s.substring(1, 4));  // Runtime exception : StringIndexOutOfBoundsException%0A%0A        // PS: substring on StringBuilder returns String, not StringBuilder object%0A    %7D%0A%7D%0A

String substring's startindex is inclusive while endIndex is exclusive