As per Object Oriented Programming (OOP) Interface should not inherit Class.
Since Interface cannot inherit Class, then how Object
class methods available to the interface reference in java?
Eg :-
public interface Test {
public void functionA();
}
class Child implements Test{
public void functionA() {
}
public static void main(String[] args) {
Test test = new Child();
test.toString(); // since toString is Objects class method, How it's visible for Test interface ref?
}
}
since toString
is Object
's class method, How it's visible for Test
interface ref?