Example 1: Java program to print the object When we print the object, we can see that the output looks different. This is because while printing the object, the toString() method of the object class is called. … Test – name of the class. @ – joins the string.