This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Java 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java 2" Watch "Java 2" New topic

Java 2

sheharyar alam

Joined: Mar 04, 2008
Posts: 4
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

Joined: Aug 31, 2004
Posts: 11343

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.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
Rob Spoor

Joined: Oct 27, 2005
Posts: 19911

BufferedReader is another option, as it has a readLine() method. This does strip away the newline characters though, but I believe so does Scanner.

How To Ask Questions How To Answer Questions
It is sorta covered in the JavaRanch Style Guide.
subject: Java 2