java在终止时做 [英] java do while termination
本文介绍了java在终止时做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此程序要求用户输入数字,然后从列表中带回详细信息。我该怎么做?
This program asks the user to input a number and then brings back the details from an list. how do I do this?
do {
Scanner in = new Scanner(System.in);
System.out.println("Enter Number <terminated by 1>");
} while (!input.equals("-1"));
System.out.println("Session Over");
} catch (Exception e) {
System.out.println(e);
}
}
}
输出:
Enter Number <terminated by 1>
123456
Person Number: 12
推荐答案
while(输入!= -1);
是比较两个整数值的正确方法。
while (input != -1);
would be the right way to compare two integer values.
这篇关于java在终止时做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文