6-1 Circle_Object
Post date: Apr 9, 2014 9:07:23 PM
package circle_object;
public class Circle
{
private double radius;
void Set_Radius(double r)
{
radius=r;
}
double get_Radius()
{
return radius;
}
double Display_Area()
{
return Math.pow(radius,2)*Math.PI;
}
}
package circle_object;
public class Circle_Object
{
public static void main(String[] args)
{
Circle box=new Circle(); // Create a Circle object.
box.Set_Radius(4);
System.out.println("The area of the circle of radius " + box.get_Radius()+" is " + box.Display_Area());
}
}