System.out.println("Calling an A's version of xyz"); new A().xyz(); System.out.println("Calling a B's version of xyz"); new B().xyz();