In this example we are taking a sub string from a given string.
In this example we are creating an string object .We initialize this string object as "Rajesh Kumar". We are taking sub string by use of substring() method.
The methods used:
This method is used to find all sub string after index i.
substring(int start,int end):
This is used to find the substring between start and end point.
The code of the program is given below:
The output of the program is given below:
C:\convert\rajesh\completed>java SubstringExample1 String : Rajesh kumar String after 3rd index: esh kumar Substring (1,2): a
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.