• 救命啊!while(true)循环跳不出去了!!
  • 其它
    1.00元

public class Solution {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
ArrayList arr = new ArrayList<>();
String s = sc.nextLine();
while (true){
arr.add(s);
if(s.equals("结束"))
break;

       arr.add(s);

   }

   for(String a : arr) {
       System.out.println(a);
   }
   //在此编写你的代码
}

}
这个循环为什么无法跳出?


  • vicky    2020-06-18 10:11:06
  • 阅读 1122    收藏 0    回答 1
  • 邀请
  • 收藏
  • 分享
发送
登录 后发表评论
  • 51testing软件测试圈微信