//all classes extend from Object class (by default, if no extend keyword used) //so eg27_GradedActivity class (.java) inherited from Object class public class eg33_ObjectMethods { public static void main(String[] args) { //create two objects using another class eg32_PassFailExam exam1 = new eg32_PassFailExam (0,0,0); eg32_PassFailExam exam2 = new eg32_PassFailExam (0,0,0); //call the toString method of Object class by inheritance //The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. System.out.println(exam1); System.out.println(exam2); if (exam1.equals(exam2)) System.out.println("They are the same."); else System.out.println("They are not the same."); } }