I have an easy \'homework\' to do, but I have found a little problem with the closure of the input stream. To put it simply, I have to make a contact \'list\' application in Jav
Your problem is indeed due to the try-with-resource statement that closes new InputStreamReader(System.in)
which behind the scene closes also the underlying input stream that is System.in
(in
is a public static
field of System
) such that in your modify
method System.in
is already closed and then cannot be read anymore this is why you get this exception.