What is String Class Methods In Java?
In Java, the String class provides various methods to manipulate and interact with string data. Key methods include:
length()
: Returns the length of the string.charAt(int index)
: Returns the character at the specified index.substring(int beginIndex, int endIndex)
: Extracts a portion of the string.indexOf(String str)
: Finds the first occurrence of a substring.toLowerCase()
/toUpperCase()
: Converts the string to lower or upper case.trim()
: Removes leading and trailing whitespace.equals(Object obj)
: Compares two strings for equality.concat(String str)
: Joins two strings together.