nextInt()输入报错
package com.example.io;
import java.util.Scanner;
public class MyClass {
public static void main(String[] args)
{
Scanner sin=new Scanner(System.in);
int a=sin.nextInt();
System.out.println(a);
System.out.println("a");
}
}
小白非常疑惑。。。 这个为啥会报错。。。
错误提示nextInt()有问题 但是为啥啊
Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at com.example.helloapplet.HelloWorldApplet.main(HelloWorldApplet.java:11)
FAILURE: Build failed with an exception.