Java Scanner no line found, and then Scanner closed error?

前端 未结 3 1893
名媛妹妹
名媛妹妹 2021-01-27 18:00

I have Java code that asks for user input and then stores this data in a string variable. The below function is part of a class called \'number\' and is called in the main funct

3条回答
  •  旧巷少年郎
    2021-01-27 18:13

    You have closed the scanner inout stream readIn.close(); twice.

    You are closing the stream before picking line by line from the file. So you have to close it once after all the instances that use readIn is finished.

提交回复
热议问题