Q:

Polymorhism and the class Object

We know that each class extends from Object which means that we can use all Object's methods
in any class. My problem is the following: 
   interface B{

       }

       public class A implements B{
          public static void main(String[] args){

             B i = new A();
             i.display();//we can't do this : because the interface B doesn't define such a method

             System.out.println(i.toString());// we can do this although the interface doesn't extend from Object                           

          }
          public void display(){         

          }

      }

so I think the problem is clear , why I could invoke the toString method although the interface B can't extend from Object?

A:

This is spelled out in the JLS §9.2. Interface Members:

If an interface has no direct superinterfaces, then the interface implicitly declares a public abstract member method m with signature s, return type r, and throws clause t corresponding to each public instance method m with signature s, return type r, and throws clause t declared in Object, unless an abstract method with the same signature, same return type, and a compatible throws clause is explicitly declared by the interface.

This ensures that it is possible to call Object methods via any interface.

