java.io.IOException: The handle is invalid

后端 未结 1 1370
天命终不由人
天命终不由人 2021-01-28 15:34

I am trying to learn programming on my own time and I am still trying to get the hang of it. I am getting the following error:

java.io.IOException: The h

1条回答
  •  北荒
    北荒 (楼主)
    2021-01-28 15:42

    Well you're closing input in the finally block of the constructor, before you actually start using it. Move the closing part out of the constructor to somewhere it will be called when you're done, such as below the call to arrayListWithNumbers or a separate close method that you call from you main.

    I think you are confusing finally with finalize() which you should not use for this purpose either.

    0 讨论(0)
提交回复
热议问题