+ 1
nextInt();
when i use this it throws noSuchElement exeption i imported java.util.scanner please help
4 ответов
+ 5
Terraria_master7 if your using multiple inputs remember that your scanner is looking for a new line containing either a string or a integer, when inputting make sure you use diffrent lines and that the input matchs the specified type as you cant use nextInt() for string this would thow an exception
+ 2
i did
+ 1
you need to create Scanner
Scanner sc = new Scanner(System.in);
int number;
number = sc.nextInt();
if i remember good