How exactly is inheritance implemented in Java? For example, consider this:
class A {
public void foo() {
System.out.print("A");
}
}
class B extends A {
...
}
class Test {
public static void main(String[] args) {
B test = new B();
test.foo(); // how is foo() called?
}
Below the line, would the compiler just dump the definition of A.foo() into the body of class B? Like
class B extends A {
...
public void foo() {
System.out.print("A");
}
}
Or is foo somehow looked up in class A and called there?