ATSCAN | Advanced dork Search & Mass Exploit Scanner | Hacking library
kandi X-RAY | ATSCAN Summary
kandi X-RAY | ATSCAN Summary
Advanced dork Search & Mass Exploit Scanner
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ATSCAN
ATSCAN Key Features
ATSCAN Examples and Code Snippets
Community Discussions
Trending Discussions on ATSCAN
QUESTION
I am pretty new at Java and am just learning so please be kind.
I am doing a coding Inheritance challenge and I'm trying to use user inputs to set up a car before driving.
When I call the 2 methods I am using to set the parameters with Scanner this first method testCar.drivingTest()
works fine, however when testCar.carAgeType()
is called, I get an exception.
Below are the requests and inputs as well as the exception.
Would you like to test a used car today? : y or n
y
great , do you have a driving licence :type: big, medium or small
big
Great you passed your 'big' exam. Lets check the MOT : type: pass or fail
pass
What type of car were you looking for :type: sports , town or 4X4
...ANSWER
Answered 2020-Aug-21 at 10:21From the Oracle documentation on the Scanner class:
When a Scanner is closed, it will close its input source if the source implements the Closeable interface.
This means that when your first method closes the scanner, it closes also the input (System.in) and that's why you get the exception and also why calling only one method doesn't throw the exception.
Just close only the first scanner you have in your main and it should solve your issue.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ATSCAN
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page