Computer Applications

Mention the purpose and syntax of trim() method.

Java String Handling

2 Likes

Answer

The trim() method of the String class removes the leading and trailing spaces from a string. It does not remove the spaces present in between the string.
Syntax:
stringObject.trim()

Answered By

2 Likes


Related Questions