//PROGRAM TO SHOW THE USE OF INTERFACE
interface Area
{
final static float pi=3.14F;
float compute(float x, float y);
}
class Rectangle implements Area
{
public float compute(float x,float y)
{
return (x*y);
}
}
class Circle implements Area
{
public float compute(float x,float y)
{
return (pi*x*x);
}
}
class InterFaceTest
{
public static void main(String args[])
{
Rectangle r=new Rectangle();
Circle c=new Circle();
Area ar;
ar=r;
System.out.println(“Area of rec=” + ar.compute(10,30));
ar=c;
System.out.println(“Area of rec=” + ar.compute(10,0));
}
}