What is the difference between 1.Overload and override? Can overload change the return value type?
Override:
Refers to a method in which a subclass appears exactly the same as the parent class name, called Override.
However, the return value type cannot be changed.
Overload:
Refers to the same class where the name appears, but the formal parameters are not the same method, called Overload.
You can change the return value type.
Note:
Overload: Method Overloading
Override: Method Overrides
What do the 2.this keywords and super keywords stand for? And their respective usage scenarios and roles.
This
Refers to a member variable or a member method in the same class.
This.value;this.function ();
Super
Refers to a member variable or member method that references a parent class.
Super.value;super.function ();
But! 1. Parent class private variable cannot be inherited, so super! cannot be
2. The parent class private method cannot be called, so it cannot be super!
Java Exercises 2