This question already has answers here:
What does a “Cannot find symbol” or “Cannot resolve symbol” error mean?
(13个回答)
2年前关闭。
每当我尝试在命令提示符下编译此Java程序时,都会出现有关
(13个回答)
2年前关闭。
每当我尝试在命令提示符下编译此Java程序时,都会出现有关
System.out.printIn
的错误,提示javac找不到符号。 System.out.print正常工作,但System.out.printIn拒绝合作。我已经在下面发布了程序和编译器消息。谢谢您的帮助。 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
最佳答案
它是带l
(小写字母L
)而不是I
(大写字母i
)的println。