/** * Illustrate the basics of inheritance * "Extends object" is unnecessary it is assumed. * @author gtowell * Created: Feb 2021 */ public class Inherit extends Object { public static void main(String[] args) { Inherit inh1 = new Inherit(); Inherit inh2 = new Inherit(); Inherit inh3 = inh1; System.out.println(inh1); // implicit use of toString() System.out.println(inh2.toString()); // explicit toString System.out.println("Equals " + inh1.equals(inh2)); System.out.println("Equals " + inh1.equals(inh3)); System.out.println("== " + (inh1 == inh2)); System.out.println("== " + (inh1 == inh3)); } }