my dog learned polymorphism
The moose likes Beginning Java and the fly likes Error cannot find symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Error cannot find symbol" Watch "Error cannot find symbol" New topic
Author

Error cannot find symbol

Andrew Cannella
Greenhorn

Joined: Sep 15, 2012
Posts: 1
Hello Everyone! I would like to give thanks for any help in advance.
So, I am trying to set a variable for System.out, but I always get an error saying that the symbol cannot be found.
Here is my code:


public class TestPrinter
{
public static void main(String[] args)
{
PrintStream printer=System.out;

String phrase="I'm so frustrated";

printer.println(phrase);
}
}

Error Message:
C:\Source>javac TestPrinter.java
TestPrinter.java:5:Cannot find symbol
PrintStream printer=System.out;
^
symbol: class PrintStream
location: class TestPrinter
1 error

I'm sure it is something silly, but for the life of me I cannot figure it out.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 792
    
    2

Please put your code inside code tags.

You are missing an import statement at the beginning of your code:


The quieter you are, the more you are able to hear.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Error cannot find symbol
 
Similar Threads
Problem compile
System.err and System.out
Getting Compile time error
Registering for SCJP Exam
question regarding initialzer.