String.toString() has the following syntax.
public String toString()
In the following code shows how to use String.toString() method.
public class Main { public static void main(String[] args) { String s = "java2s.com"; System.out.println(s.toString()); } }
The code above generates the following result.