When a Java program is being compiled the compiler creates a list of all the identifiers in use. If it can't find what an identifier refers to (e.g., there is no declaration statement for a variable) it cannot complete the compilation. This is what the
cannot find symbol error message is saying, it doesn't have enough information to piece together what the Java code wants to execute.
The following code:
will cause a
System.out.prontln("The perils of mistyping..");
cannot find symbolerror because the
System.outclass does not have a method called “prontln”:
cannot find symbol symbol: method prontln(jav.lang.String) location: class java.io.printStream
The two lines below the message will explain exactly what part of the code is confusing the compiler.