DEV Community

     NSP.Mathi
NSP.Mathi

Posted on

Basic intro about Interface class in Java

Why should we used Interface class?

Usually an Abstract method inherited other abstract class properties and method but it doesn't inherited a constructor. So, then we use interface class and it doesn't have any properties. It have only methods. it only inherited interface constructor. if we inherit a interface class to other class we should use implements keyword.

Parent Class:

public interface class Animal {   
//Statement
public interface walk();

}
Enter fullscreen mode Exit fullscreen mode

Child Class:

public class Dog implements Animal {   

public interface walk(String name, String email){
//Statement
}

}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)