Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
TDD for a Shopping Website LiveProject
this week in the
Testing
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Liutauras Vilda
paul wheaton
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Carey Brown
Frits Walraven
Bartenders:
Piet Souris
Himai Minh
Forum:
Java in General
BufferedReader Problem
joeF
Greenhorn
Posts: 8
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi:
I trying to display on the screen text from multiple files. I am only able to display the first file. Can somone look at my code and tell me the reason and a possible solution?
Thanks.
import java.io.*; class BufferedReaderDemo { public static void main(String args[]) { try { for (int i = 0 ;i< args.length; i++) { // Create a file reader FileReader fr = new FileReader(args[i]); // Create a buffered reader BufferedReader br = new BufferedReader(fr); // Read and display lines from file String s; while((s = br.readLine()) != null) System.out.println(s); // Close file reader fr.close(); } } catch(Exception e) { System.out.println("Exception: " + e); } } }
[ December 18, 2002: Message edited by: Cindy Glass ]
Jon Strayer
Ranch Hand
Posts: 133
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
It works for me. What symptoms are you seeing?
Jon
joeF
Greenhorn
Posts: 8
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
It works after a second try.
???
Thanks.
Cindy Glass
"The Hood"
Posts: 8521
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
joeF,
Just another reminder to change your display name to meet the naming requirements (2 names with a space in between).
Thanks.
"JavaRanch, where the deer and the Certified play" - David O'Meara
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Scanner class
Reading a file from a directory.
Unusual FileNotFoundException error
problem in IO reader
How To Read A Web Page
More...