Are interfaces also inherited from Object class?

interfaces not inherited from object class and there’s no common or root interface which implicitly inherited by all interfaces either.

Note: For each public method in Object class, there’s an implicit abstract and public method declared in each interface which doesn’t have direct super interfaces. This standard is defined by JLS (Java Language Specification) as

“If an interface has no direct super interfaces, 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 a method with the same signature, same return type, and a compatible throws clause is explicitly declared by the interface.”

Please check the below example how Object class methods are available in interface: Example

interface Test
    public boolean equals(Object obj);
    public int hashCode();
    public String toString();
public class Main
    public static void main(String[] args)
        Test test = null;


Exception in thread "main" java.lang.NullPointerException  
        at Main.main(

Java interview questions on Inheritance

Please follow and like us:
Content Protection by