import java.util.Scanner;
public class Count {
public static void main(String []args){
Scanner s=new Scanner(System.in);
int i=s.nextInt();
int j=i+1;
System.out.println(j);
}
}
这是java中的基本代码,当我在自己的PC上运行它时,它运行良好,我在在线编译器上编译和执行的相同代码,它给出了一些错误,为什么?
Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:907)
at java.util.Scanner.next(Scanner.java:1530)
at java.util.Scanner.nextInt(Scanner.java:2160)
at java.util.Scanner.nextInt(Scanner.java:2119)
at Count.main(Count.java:28)