Why Object class methods are available in interface?
<p><strong>Following interface and classes are successfully compiled.
Problem is mentioned in the output below :</strong></p>

<pre><code>interface MyInterface{}

class MyClass implements MyInterface{}

class InterDoubt{

    static MyInterface mi ;//= new MyClass() ;

    public static void main(String[] args){
        System.out.println("X") ;

        try{
            synchronized(mi){
                try{
                    mi.wait(4000) ;
                }
                catch(InterruptedException ie){
                    System.out.println("Exception occured at main.") ;
                }
            }
        }
        catch(Exception e){
            System.out.println("voilla, MyInterface is an interface,\n" + 
                       "then why compiler allows compilation of\n" +
                       "mi.getClass(), mi.wait().\n" +
                       "Or how the methods of Object class are available in an interface."
            );
        }

        System.out.println("Y") ;
    }
}
</code></pre>

<p><strong>output :</strong> </p>

<p>X</p>

<p>voilla, MyInterface is an interface,</p>

<p>then why compiler allows compilation of</p>

<p>mi.getClass(), mi.wait().</p>

<p>Or how the methods of Object class are available in an interface.</p>

<p>Y</p>

<hr>

<p><strong>Edited</strong> :-
I am accepting answer from disown, as it's the most explanatory. But after reading the answer, one more issue get's populated :-</p>

<p>"<strong>Remember if the interface tries to declare a public instance method declared 'final' in the Object class then it'll result into a compile-time error. For example, 'public final Class getClass()' is a public instance method declared 'final' in the Object class and therefore if an interface tries to declare a method with this signature then the compilation will fail</strong>"  (Quoted from explanation).</p>

<p>then why the following code is getting successfully compiled :-</p>

<pre><code>interface MyInter{
    public void method() ;
}

class MyClass implements MyInter{

    public final void method() {
        .......
        .......
              .......
    }

}
</code></pre>
