Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The error I ' m getting is: Exception in thread main java.util.NoSuchElementException at java.base / java . util.Scanner.throwFor ( Scanner . java: 9 3 7
The error I
m getting is: Exception in thread "main" java.util.NoSuchElementException
at java.base
java
util.Scanner.throwFor
Scanner
java:
at java.base
java
util.Scanner.next
Scanner
java:
at java.base
java
util.Scanner.nextInt
Scanner
java:
at java.base
java
util.Scanner.nextInt
Scanner
java:
at LabProgram.main
LabProgram
java:
Heres my code and see why I
m getting this through Zybooks Lab
: import java.util.Scanner;
public class LabProgram
public static void main
String
args
Scanner scnr
new Scanner
System
in
;
String firstName;
int wholeNumber;
String pluralNoun;
String genericLocation;
System.out.println
Enter a first name:
;
firstName
scnr
nextLine
;
System.out.println
Enter a whole number:
;
wholeNumber
scnr
nextInt
;
System.out.println
Enter a plural noun:
;
pluralNoun
scnr
next
;
System.out.println
Enter a generic location:
;
genericLocation
scnr
next
;
System.out.println
firstName
buys
wholeNumber
different types of
pluralNoun
at
genericLocation
;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started