The toString() method of the Object class will execute when we print the reference variable in our class.**
public class HelloWorld {
public static void main(String a[]) {
String name = “Venu”;
System.out.println(“the name is : “+name);
} }//because the String class is overriding the toString().
public class HelloWorld {
public static void main(String a[]) {
String name = “Venu”;
System.out.println(“the name is : “+name);
} }//because the String class is overriding the toString().