2

Whenever I try to compile this Java program in the command prompt I get an error about System.out.printIn saying that javac cannot find symbol. System.out.print works just fine but System.out.printIn refuses to cooperate. I've posted the program and the compiler message below. Thanks for the help.

    public class BeerSong {
public static void main (String[] args) {
int beerNum = 99;
String word = "bottles";

while (beerNum > 0) {

  if (beerNum == 1) {
    word = "bottle"; //singular, 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

C:\Users\Jesse\Desktop>javac BeerSong.java
BeerSong.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");
              ^
BeerSong.java:13: cannot find symbol
symbol  : method printIn(java.lang.String)
location: class java.io.PrintStream
    System.out.printIn(beerNum + " " + word + "of beer.");
              ^
BeerSong.java:14: cannot find symbol
symbol  : method printIn(java.lang.String)
location: class java.io.PrintStream
    System.out.printIn("Take one down.");
              ^
BeerSong.java:15: cannot find symbol
symbol  : method printIn(java.lang.String)
location: class java.io.PrintStream
    System.out.printIn("Pass it around.");
              ^
BeerSong.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");
                  ^
BeerSong.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");
                      ^
6 errors
Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
SnowBeef
  • 143
  • 1
  • 2
  • 10

4 Answers4

20

It is println with l (lower case L), not I (upper case i).

MByD
  • 135,866
  • 28
  • 264
  • 277
3

Typo:

printIn should be println

codaddict
  • 445,704
  • 82
  • 492
  • 529
3

It should be System.out.println not System.out.printIn.

Use some kind of IDE (like Eclipse or NetBeans) to make sure that you can use methos in current context.

The problem here is copying the same line. Try avoiding copy/pase.

Igoris Azanovas
  • 1,640
  • 1
  • 22
  • 37
2

it is System.out.println and NOT System.out.printIn (lower case L and not upper case i)

amit
  • 175,853
  • 27
  • 231
  • 333