I just started a new java project today, and I'm having a problem with println. Here's my main method:
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
The javac output
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");
What did I do wrong? I've never had problems with println before.
You concatenate Strings with +
not ,
System.out.println("You have ", numGuards, " guards");
Should become
System.out.println("You have " + numGuards + " guards");