wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Read file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Read file" Watch "Read file" New topic
Author

Read file

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635


The second while doesn't work , why?

I want to compare and test difference between readline and read.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42371
    
  64
ItDoesntWorkIsUseless.

The first loop exhausts the input - there's nothing left for the second loop to read.


Ping & DNS - my free Android networking tools app
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

Comment for first while loop then you will know how second while loop execute.


Life is easy because we write the source code.....
abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635
Then the solution is that I must create new FileInputStream?
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

You may also create new BufferedReader to read from the top.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Read file