Why Is My Interface Default Method Not Being Called?

Profile Picture

Henrique Sa

OP
Admin
@riquelds.bsky.social
3 days ago

I expected the default method to run, but Java keeps using the overridden version even when I remove it.

interface A {
    default void hello() {
        System.out.println("Hello from A");
    }
}

class B implements A {
    // I removed the override but it's still not calling A's method?
}
java oop