iam new to java..can anyone tel me wats wrong in dis program..plz explain..
interface area
{
final float pi=3.14F;
float cal(float x,float y);
float c(float r);
}
abstract class rectangle implements area
{
public float cal(float x,float y)
{
return x*y;
}
}
class circle implements area
{
public float c(float r)
{
return pi*r*r;
}
}
class inf
{
public static void main(String args[])
{
rectangle r=new rectangle();
circle ci=new circle();
area area1;
area1=r;
System.out.println(area1.cal(9,8));
area1=ci;
System.out.println(area1.c(8));
}
}
Tags: