I've got a question about overriding methods. OK, we've got an OOP here, I can understand what result I'll got. But.. How does the jdk resolve, what implementation to use in each case?
public class One {
One() {
run();
}
public void run() {
System.out.println("One");
}
}
public class Two extends One {
@Override
public void run() {
System.out.println("Two");
}
}
public class Test {
public static void main(String[] args) {
One test = new Two();
}
}
I'm really sorry for not very good code listing, I was in a hurry. Changes added.