String Function
String Function
The index number starts from 0 and goes to n-1, where n is the length of the
string. It returns StringIndexOutOfBoundsException, if the given index
number is greater than or equal to this string length or a negative number.
Syntax
Example:
Output: t
Signature
The signature of the string length() method is given below:
Signature
The signature of the string concat() method is given below:
Example:
Output:
java string
Output:
Output:
HELLO STRING
Output
hello stringjavatpoint
8 Java String indexOf()
The Java String class indexOf() method returns the position of the first
occurrence of the specified character or string in a specified string.
Output:
index of substring 16