Написал максимально легенькую программу, чтобы не захламлять вопрос:
package ****;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
System.out.println("Enter your name: ");
String name = sc.nextLine();
System.out.println("Enter your age: ");
int age = sc.nextInt();
}
}
Ошибка:
Task :run FAILED
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1540)
at Expirement.Main.main(Main.java:7)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_271\bin\java.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at
https://help.gradle.org
BUILD FAILED in 1s
2 actionable tasks: 2 executed