我的代码是这样的:
import java.util.Scanner;
public class CalcPyramidVolume {
public static void pyramidVolume (double baseLength, double baseWidth, double pyramidHeight) {
double volume;
volume = baseLength * baseWidth * pyramidHeight * 1/3;
return;
}
public static void main (String [] args) {
System.out.println("Volume for 1.0, 1.0, 1.0 is: " + pyramidVolume(1.0, 1.0, 1.0));
return;
}
}
并且它说不能在void类型中进行打印。我只是不明白为什么...