Hi. I've copied the code for the beer song in head first
java but command prompt showing 7 errors it seems to be indicating that there's a problem with the " . " between "out" and "printIn"
I've gone over the code and it looks like I've copied it corrrectly.
Here is the error
Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\craig>cd C:\Program Files\Java\jdk1.6.0_21\bin
C:\Program Files\Java\jdk1.6.0_21\bin>javac beerbottles.java
beerbottles.java:1: class BeerSong is public, should be declared in a file named
BeerSong.java
public class BeerSong {
^
beerbottles.java:12: cannot find symbol
symbol : method printIn(java.lang.String)
location: class java.io.PrintStream
System.out.printIn (beerNum + "" +
word + "of beer on the wall");
^
beerbottles.java:13: cannot find symbol
symbol : method printIn(java.lang.String)
location: class java.io.PrintStream
System.out.printIn (beerNum + "" + word + "of beer.");
^
beerbottles.java:14: cannot find symbol
symbol : method printIn(java.lang.String)
location: class java.io.PrintStream
System.out.printIn ("take one down.");
^
beerbottles.java:15: cannot find symbol
symbol : method printIn(java.lang.String)
location: class java.io.PrintStream
System.out.printIn ("pass it around.");
^
beerbottles.java:19: cannot find symbol
symbol : method printIn(java.lang.String)
location: class java.io.PrintStream
System.out.printIn(beerNum + "" + word + "of beer on the wall");
^
beerbottles.java:21: cannot find symbol
symbol : method printIn(java.lang.String)
location: class java.io.PrintStream
System.out.printIn ("No more bottles of beer on the wall");
^
7 errors
C:\Program Files\Java\jdk1.6.0_21\bin>
The "^" points to the "." between "out" and "printIn" on the command prompt screen and not the "S" of system as it shows above if that helps
This is my source code
public class BeerSong {
public static void main (
String[] args) {
int beerNum = 99;
String word = "bottles";
while (beerNum > 0) {
if (beerNum == 1) {
word = "bottle"; // singular, as in ONE bottle.
}
System.out.printIn (beerNum + "" + word + "of beer on the wall");
System.out.printIn (beerNum + "" + word + "of beer.");
System.out.printIn ("take one down.");
System.out.printIn ("pass it around.");
beerNum = beerNum - 1;
if (beerNum > 0) {
System.out.printIn(beerNum + "" + word + "of beer on the wall");
} else {
System.out.printIn ("No more bottles of beer on the wall");
} // end else
} // end while loop
} // end main method
} // end class