Carey Brown wrote:Line 24 is VERY BAD. NEVER EVER close a scanner created from System.in.
Knute Snortum wrote:If you close a Scanner object based on System.in, you will not be able to use System.in afterwards.
Tim Holloway wrote:
If you're using System.in as a heterogeneous data source where you only feed a few lines to the scanner and send the remaining input somewhere else (perhaps even a different scanner), then it would be appropriate not to close the Scanner and simply let it drop out of scope, but this isn't a common practice, and it needs to be done with care and reference to the underlying buffer contents.
Willie Smits can speak 40 languages. This tiny ad can speak only one:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your databasehttps://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database