求助: volume cannot be solved as a variable 怎么解决?

让call一个method来计算圆锥体积
可是在printf的时候显示volume cannot be resovled to a variable
怎么修改呢?

package volume;

import java.util.Scanner;

public class VolumeofCone {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.printf("Enter the radius of the cone:\n");
double radius = input.nextDouble();
System.out.printf("Enter the height of the cone:");
double height = input.nextDouble();
System.out.printf("The volume of cone with radius %.4f and height %.4f is:%.4f \n", radius, height, volume);
double volume = getVolume(radius, height);

}

public static double getVolume(double radius, double height) {
    double volume = Math.PI * height * Math.pow(radius, 2) / 3;
    {
        return volume;

    }

}

}

把报错打印的那行放在 double volume 定义前面,变量必须先定义后使用。