public class NewClass {
public static void main(String[]args){
int beerNUM = 99;
String word = "bottles";
while (beerNum>0){
if (beerNum == 1){
word = "bottles";
}
System.out.println(beerNum + " " + word + "of beer on the wall");
System.out.println(beerNum + " " + word + "of beer.");
System.out.println("take one down");
System.out.println("pass it around");
beerNum = beerNum - 1;
if (beerNum > 0){
System.out.println(beerNum + " " + word + "of beer on the wall");
}
else{
System.out.println("no more bottles of beer on the wall");
}
}
}
}
2
Contributors
1
Reply
5 Minutes
Discussion Span
8 Months Ago
Last Updated
2
Views
Related Article:Best Book to learn Java-EE and COre java
is a Java discussion thread by chiiqui that has 1 reply, was last updated 1 year ago and has been tagged with the keywords: core-java, corejava, j2ee, java, java-ee, javaee.