Where the “super” is actually defined? [When we’re using super.someMethod()]. Is it defined as a field in java.lang.Object class or java.lang.Class class?
When we’re calling from a subclass, super contains the reference to it’s superclass.In the same manner the super in superclass itself has reference to it’s superclass [In this way upto java.lang.Object]. So, how java injects the superclass references to the “super” field which enables us to call superclass methods ?
Is there any under the hood implementaations like the following:
Class current = this.getClass();
Class parent = current.getSuperclass();
System.out.println("name is =" + parent);
superis an object-reference specific keyword that ascends the object hierarchy beginning from the calling object until it finds an ancestor object that has a matching method signature or property/field. Refer to Java documentation.