我试图调用“菜单”的方法,但它说返回类型是无效的?
我希望菜单方法中的代码在边数等于 2 时显示?
import java.util.Scanner;
class RecordDice {
public static void main(String[] args){
int dSides, Sides;
Scanner s = new Scanner(System.in);
System.out.println("How many sides should the dice have?");
Sides = s.nextInt();
if (Sides == 2){
return menu();
}
}
public String menu()
{
System.out.println("BLOODY WORK");
}
}