subString(..) method is used to fetch a chunk of letters from a String.
Say, if we want to get the String "llo" from "Hello".
Also, we want to get the String "el" from "Hello".
public class Test{ public static void main(String[] arg){ String firstString = "Hello"; String subStr1 = firstString.subString(2); String subStr2 = firstString.subString(1,2); System.out.println("The subString is : "+subStr1); System.out.println("The subString is : "+subStr2); } }