java系统。出来printIn找不到符号
每当我试图在命令提示符下编译这个Java程序时,我都会得到一个关于System.out.printIn
的错误,说javac找不到符号。系统出来打印效果很好,但不影响系统。出来普林廷拒绝合作。我已经在下面发布了程序和编译器消息。谢谢你的帮助
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
# 1 楼答案
它应该是
System.out.println
而不是System.out.printIn
使用某种IDE(比如Eclipse或NetBeans)来确保可以在当前上下文中使用Methodos
这里的问题是复制同一行。尽量避免抄袭
# 2 楼答案
打字错误:
printIn
应该是println
# 3 楼答案
它是
System.out.println
而不是System.out.printIn
(小写L而不是大写i)