当我运行它时,它不会出于某种原因要求我输入国家/地区,但如果我输入某些内容,它会在最后显示。我必须在原始问题之后添加一些内容吗?这是我到目前为止所做的。
import java.util.Scanner;
public class MadLib
{
private static Scanner in = new Scanner(System.in);
public static void main(String [] args)
{
System.out.print("What country are you from and what is your name, also how old are you? ");
System.out.println("Enter your country > ");
String country = in.nextLine();
System.out.println("Enter your name > ");
String name = in.nextLine();
System.out.println("Enter you age > ");
int age = in.nextInt();
madlib(country,name,age);
}
public static void madlib(String country,String name,int age)
{
System.out.println(" I'm from "+country+" and my name is "+name+" , and I am "+age+" years old. ");
}
}