好吧,我用 Java 做了一个简单的东西。就是这样。
class MyClass {
public static void main(String[ ] args) {
// Scanner initialization
Scanner myInfo = new Scanner(System.in);
System.out.println("Who are you? ");
String inputName = myInfo.nextLine();
System.out.println("How old are you? ");
int inputAge = myInfo.nextInt();
System.out.println("What is your aim? ");
String inputAim = myInfo.next();
System.out.println("My name is " +inputName+ "I am " +inputAge+ "years old. I wanna be a " +inputAim);
当我尝试运行它时,它会给我一个错误,提示“解析时到达文件末尾”。
答案1
我对 Java 了解不多,但你有两个{
字符,没有}
。我盲目地打赌这是罪魁祸首。直到所有左括号都遇到其右括号,文件结尾才是意外的。