• Post Reply Bookmark Topic Watch Topic
  • New Topic

using System gives error  RSS feed

 
ed jones
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if I put this in my code System.out.println("hello");

I get an error message? I would have thought I could use this anywhere in the code?

thanks
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ed jones:

I get an error message? I would have thought I could use this anywhere in the code?


Well, you can use this almost "anywhere in the code". ie. it can be in a method, constructor, or initializer. You can't just place it anywhere in a class, or outside of a class. Can we get an example of where you are putting it? And the error that you are getting?

Henry
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error message tells you a lot about what the problem is. Posting the text of that would also help diagnose the problem
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!