substring(): This method is used to extract the substring from a string
The general form is.
String substring(int sindex)
String substring(int sindex,int eindex)
Where:
sindex is the starting index position
eindex is the ending index position.
but the actuall string is extracted upto the position eindex-1
Eg.
String s="computer";
System.out.println(s.substring(3));
System.out.println(s.substring(3,6));
Output:
puter
put
Comments
Post a Comment