How can I fix an “IOException: Stream closed” exception using System.in?

你。 提交于 2019-11-27 16:17:51

The stream is closed because you're closing it with the first

br.close();

that you issue after having read the filename.

Don't close that reader, and don't create a new one for System.in - just re-use that one. Use a different one for reading from the file though.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!