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