Java StringtoString() Method
Example
Return a string's value:
String myStr = "Hello, World!";System.out.println(myStr.toString());Definition and Usage
ThetoString() method returns the string itself.
This method may seem redundant, but its purpose is to allow code that is treating the string as a more generalized object to know its string value without casting it toString type.
Syntax
public String toString()Technical Details
| Returns: | TheString object itself. |
|---|---|
| Java version: | Any |
❮ String Methods

