class Circle
{
double r;
double ar;
void area()
{
ar = 3.14*r*r;
}
void setRadius(double k)
{
r=k;
}
void result()
{
System.out.println(r+" "+ar);
}
public static void main(String[] args)
{
Circle c1 = new Circle();
c1.setRadius(2.0);
c1.area();
c1.result();
}
}
OUTPUT
Comments
Post a Comment