import java.util.Scanner;
public class Exercise5 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Input first number: ");
int num1 = in.nextInt(5);
System.out.print("Input second number: ");
int num2 = in.nextInt(25);
System.out.println(num1 + " x " + num2 + " = " + num1 * num2);
}
}
**Here is my java code, the expect output should be like this:
Input first number: 25
Input second number: 5
25 x 5 = 125
After I plug in my code and run it, the output is too different with the answer
Here is the output:
Input first number: 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 Exercise5.main(Exercise5.java:27)
How can I fix my code?