String.substring()
This method is a predefined (built-in) method of String class, its returns sub string (a part of string) from given start to end index.
Syntax:
String.substring(int start_index, int end_index);
Here, start_index is the start index from where we have to get the string. end_index is the end index.
Consider the program:
Given string, start index and end index and we have to get the substring from the string.
Output