While looking at some OOP materials, I thought of this question which confused me a little bit:
Consider having the following interface,abstract class, and a concrete class:
package one;
public interface A {
void doStuff();
}
package one;
public abstract class B implements A {
public abstract void doStuff();
}
class C extends B{
public void doStuff() {
}
}
Class C won't compile unless it provides an implementation for method doStuff().
The question here:
1-Is doStuff() method in class C an implementation to the interface A's method, or it is for the abstract method in class B ? to be more specific: How will the JVM
treat the function, as an invoked function of the interface or the abstract class ?
2-Is the abstract method doStuff() in abstract class B considered to be an "implementation" for the doStuff() method in interface A? so that makes it mandatory for class C to implement the abstract class's version of doStuff() instead of the interface's ?