java_research
java_research
In a class hierarchy, when a method in a subclass has the same name and
type signature as a method in its superclass, then the method in the
subclass is said to override the method in the superclass. When an
overridden method is called through its subclass, it will always refer to the
version of that method defined by the subclass. The version of the method
defined by the superclass will be hidden. Consider the following:
The output produced by this program is shown here:
k: 3
If you substitute this version of A into the previous program, you will
see the following output:
i and j: 1 2
k: 3