I wanted to do the same exercise as mentioned in the above link. But, I ran into
NoSuchElementException when I tried to use
inConsole.nextLine(), after successfully closing
BufferedReader object, in spite of reassigning
inConsole = new Scanner(System.in) to read from Standard input.
BufferedReader object, can’t I reassign to Scanner object like above and use it?
Never close neither
System.out. This will work and cause some strange effects. Actually you will never be able to read or write to SYSIN of SYSOUT respectively. Find other solution.
If you need advise how to solve your problem without closing
System.in please provide more information about lifecycle of your application and probably send relevant code snippets.