How to use interface Java

public class Main 
{
   public static void main(String args[])
   {
      BallAttributes objBallAttributes = new BallAttributes();
      RubberBall     objRubberBall     = new BallAttributes();
		
      objBallAttributes.bouncable();
      objRubberBall.moveable();
   }
}

class BallAttributes implements RubberBall, Movable 
{
    public void bouncable()
    {
      System.out.println("I am Bouncing");
    }	
    
    public void moveable()
    {
      System.out.println("I am Moving");
    }	
}

interface RubberBall 
{
    public void bouncable();
}

interface Movable 
{
    public void moveable();
}

Leave a reply