I'm still learning how to code using java, and i run into problem that i can't solve myself.
compiler says :
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 GetInputData.main(GetInputData.java:10)
Here is the code
import java.util.Scanner;
public class GetInputData
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int tag;
System.out.println("Enter an integer: ");
tag = in.nextInt();
System.out.println("Input Integer is: "+tag);
}
}
have been looking around for solution but it looks like lot of people had this kind of problem, so if any of you guys had other workaround can you please share to me, i just want a simple program that read from whatever we input, thanks.