Sunday, 18 December 2022

b) Develop a Simple program of interface mentioned below points; 1)Interface name animal 2) Method name walk 3)Implements horse class 4)Display the message is – walks on 4 legs



INTERFACE : 

interface animal  
{
    public void walk();
   
}
class horse implements animal
{
    public void walk ()
    {
       System.out.println("walk on 4 legs");
    }
}
public class inter_face
{
    public static void main (String args [])
    {
      horse h = new horse();
      h.walk();  
    }

}


OUTPUT:     walk on 4 legs

No comments:

Post a Comment

GitHub Most Imp Command For Every Developer Learn:

 Top Command for GitHub:  1) git clone 2) git init and git status   3) git add file name  or git add .  4) git commit -m message  5) git rem...