Adding an object from file into program

后端 未结 3 1465
死守一世寂寞
死守一世寂寞 2021-01-26 14:23

I\'m programming a game and in the program I need to add new enemies based off of a file. Right now my problem is that I\'ve run into an infinite while loop when trying to read

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-26 14:34

    You have written : while(input.hasNext());

    You need to remove the semi colon first.

    Next you have closed the input within the loop that also needs to be done outside the loop as after the first time the input being closed will not get processed and will give exception.

提交回复
热议问题