java 中scanner sc=new scanner(system.in) 怎么关闭sc

2025-03-13 19:07:52
推荐回答(3个)
回答1:

不要用while,直接用nextInt(),next()这样的方法,while(sc.hasNext())永远不会跳出去。

回答2:

sc.close()...

回答3:

把while 改为if