Varuna Seneviratna
As Carey said, closing System.in via one Scanner closes it completely and you can't reopen it.Varuna Seneviratna wrote:. . . two pipes to System.in is opened and then one closed? . . .
Varuna Seneviratna
Varuna Seneviratna wrote:Using documentation how can this be understood? By looking at the documentation at https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html#close-, How could this be understood?
Campbell Ritchie wrote:But System.in always implicitly might have a next line; as soon as you push any key that next line will exist and hasNextLine() will return true. So...is going to behave as an infinite loop.
. . . when you close that one input stream, both Scanners that use the input stream can no longer process data from it. . . .