The substring method can be used to extract some characters from the
String . These substrings can be obtained using indices.
This method comes in two forms:
public String substring(int beginIndex) Returns a new string that is a substring of this string. The substring begins with the character at the beginIndex and extends to the end of this string.public String substring(int beginIndex, int endIndex) This returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index (endIndex - 1) .
Get Substring from String CODE class Substring OUTPUT Merit Campus DESCRIPTION The program shows the two variants of THINGS TO TRY
|