Basic intro about Interface class in Java

NSP.Mathi - Jul 14 '23 - - Dev Community

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
. . . . . . .
Terabox Video Player