Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error reading from input file?

 
Tom Brodhead
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to open a text file for input using the Eclipse IDE and I'm receiving error messages I can't resolve. Here's my code:



Eclipse flags the "String file" line as an error with the following message:


Syntax error on token ";", { expected after this token


It also flags the final } with this message:


Syntax error, insert "}" to complete ClassBody


What am I doing wrong here?

TIA!
~~Tom
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot just add code to a class. You have to put the code in a method. Also, Stdout is not Java. See below.
 
Tom Brodhead
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks--this was an embarrassing brain fart--forgot to put it into a method. I'm actually planning on calling the resulting method from a class with a main() method elsewhere; the Stdout routine is part of the larger package this belongs to.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic