我今天剛剛開始一個新的java項目,並且遇到了println的問題。這是我的主要方法:找不到符號println
public static void main(String[] args) {
String stringNumGuards = JOptionPane.showInputDialog("How any guards do you have?");
int numGuards = Integer.parseInt(stringNumGuards);
Controller headGuard = new Controller();
System.out.println("You have ", numGuards, " guards");
} //main
javac的輸出
Controller.java:10: cannot find symbol
symbol : method println(java.lang.String,int,java.lang.String)
location: class java.io.PrintStream
System.out.println("You have ", numGuards, " guards");
我做了什麼錯?我以前從來沒有遇到與println有關的問題。
用+符號替換逗號 – andy256