• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error cannot find symbol

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 825
5
Python Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please put your code inside code tags.

You are missing an import statement at the beginning of your code:
 
reply
    Bookmark Topic Watch Topic
  • New Topic