[英]Beginner Java Code not working - While loop error
I have an error in the while loop. 我在while循环中有一个错误。 The While Statement is showing as an error in Eclipse?
While语句在Eclipse中显示为错误? What am I missing... (Yes I know it is simple code... I am going to start with beginner code first.
我缺少什么...(是的,我知道这是简单的代码...我将首先从初学者代码开始。
/**
* @author Nathan
*
*/
public class DietCokeSong {
/**
* @param args
*/
public static void main(String[] args) {
int dietCokeNum = 99;
String word = "Cans of Diet Coke";
While(dietCokeNum > 0) {
System.out.println(dietCokeNum + " " + word + " on the wall");
System.out.println(dietCokeNum + " " + word + ".");
System.out.println("Take one down.");
System.out.println("Pass it around.");
dietCokeNum = dietCokeNum - 1;
if(dietCokeNum > 0) {
System.out.println(dietCokeNum + " " + word + " on the wall");
} else {
System.out.println("No more Cans of Diet Coke on the wall.");
}
}
}
}
The W in "while" should not be capitalized. “ while”中的W不应大写。 I think that is all.
我认为仅此而已。
while
应使用小写字母...而“饮食可乐”应使用“啤酒” ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.