Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java 2

 
sheharyar alam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello guys

I am new at this stuff, so I am trying to learn this java stuff lol,

but anyway

My qustion is how do I Read text line by line and print it as it appears in the given data file
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

Take a look at the Scanner class.

If you're having trouble with it, show us what you've tried and where you're stuck.
 
Rob Spoor
Sheriff
Pie
Posts: 20531
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BufferedReader is another option, as it has a readLine() method. This does strip away the newline characters though, but I believe so does Scanner.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic