如果我有以下两个功能。如何选择将要选择的功能?
我想要么有某种形式的语句来确定扫描仪的内容,因此只有一个功能。或者它将是传递给函数的东西。
public static int questionAsk(String question)
{
Scanner scan = new Scanner (System.in);
System.out.print (question+"\n");
System.out.print ("Answer: ");
return scan.nextInt();
}
public static String questionAsk(String question)
{
Scanner scan = new Scanner (System.in);
System.out.print (question+"\n");
System.out.print ("Answer: ");
return scan.nextLine();
}