Circle

Report a typo

There is a class named Circle. This class has one field radiusof the double type.

Create two instance methods for this class:

  • getLength that returns the double representing the length of the circumference of this circle;
  • getArea that returns the double representing the area of this circle.

In your calculations, you may use the special constant Math.PI.

Do not make the field and methods private.

Write a program in Java 17
class Circle {

double radius;

// write methods here
}
___

Create a free account to access the full topic