JAVA PROGRAMS-Interface Demo program in java
Interface Demo program in java
Program Name:- inter1
import java.io.*;
interface demo
{
final double pi=3.14;
abstract double area(int r);
}
interface demo1
{
abstract double circum(int r);
}
class cir implements demo,demo1
{
public double area(int r)
{
return pi*r*r;
}
public double circum(int a)
{
return 2*pi*a*a;
}
}
class inter1
{
public static void main(String arg[])
{
cir c=new cir();
System.out.print("\nCircle\t:"+c.area(5));
System.out.print("\nCircum\t:"+c.circum(5));
}
}
No comments:
Post a Comment