The toString() process returns the string depiction of the object. If you print any entity, the java compiler inside invokes the toString() process on the object.
Here is the syntax of this method:
public String toString()
Here is the detail of parameters:
Example
import java.io.*; public class Test { public static void main(String args[]) { String Str = new String("Welcome to Intellinuts.com"); System.out.print("Return Value :"); System.out.println(Str.toString()); } }
This will produce the following result:
Return Value :Welcome to Intellinuts.com
Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.