Sunday, August 12, 2012

Using of interface in java program


interface x
{
public void area();
}

class y implements x
{
int a,b;
           public void area()
{
a=5;b=7;
System.out.println("Area is "+a*b);c
}
}

 class z implements x
{
int a;
public void area()
{
a=5;
System.out.println("Area of box is "+a*a);
}
}

class inter
{
public static void main(String[] args)
{
y a=new y();
z s=new z();
a.area();
s.area();
}
}

No comments:

Post a Comment