I'm still starting to learn methods in Java, anyone know how to pass on the information into the area variable?
import java.math.*;
public class AreaCircle {
static double radius;
static double area;
public static void circleInput() {
Scanner sc = new Scanner(System.in);
System.out.println("Radius: ");
double radius = sc.nextDouble();
}
public static void processing() {
double area = Math.PI * (radius * radius);
}
public static void output() {
System.out.println("Area: "+area);
}
public static void main(String args[]) {
circleInput();
processing();
output();
}
}
Output
Area: 0.0
I am just doing a simple code to calculate the area of a circle, and I want to have three methods in the code, the input, processing, and output.