我想通过指令方法打印菜单,但程序什么也不执行。谁能告诉我如何解决这个问题。
这是类中的方法声明..
public class Factorial
{
public void instructions()
{
System.out.printf("Enter your choice:\n",
" 1 to calculate a factorial value of an integer.\n",
" 2 to calculate mathematical constant e.\n",
" 3 to calculate e^x.\n",
" 4 to end.\n");
} // End of instructions
}
这是从 Factorial 类调用指令方法的主要方法。
import java.util.Scanner; // Program uses scanner.
public class behzat
{
private static Scanner input;
public static void main(String[] args)
{
Factorial myfactorial = new Factorial();
myfactorial.instructions();
}
}