The oracle textbook says: If your method overrides one of its superclass methods, you can call the method overridden with the super keyword.
He mentioned the use of super in an overridden method.
However, in reality, in the example program I wrote, I can use super words to access any method in the superclass.
The question here is: why do most people talk on the Internet about using super, do they always talk about calling the override method?
I mean, why is “using super to call another method in a superclass” not recommended?
By the way, one more question: we cannot use super in a static method. The compiler will not allow us to do this.
This is because the variable "super" belongs to the object instead of the class, just like the keyword "this" ?. The static method belongs to the class, but is there a super variable in the static method ?
source
share