Код: Выделить всё
package org.example;
class Superclass {
private void interestingMethod() {
System.out.println("Superclass's interesting method.");
}
void exampleMethod() {
System.out.println("this is " + this);
this.interestingMethod();
}
}
class Subclass extends Superclass {
void interestingMethod() {
System.out.println("Subclass's interesting method.");
}
public static void main(String args[]) {
Subclass me = new Subclass();
me.exampleMethod();
}
}
почему? Не могу понять?
Подробнее здесь: https://stackoverflow.com/questions/784 ... -is-called