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
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
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
Java in General
BufferedReader Problem
joeF
Greenhorn
Posts: 8
posted 21 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 21 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 21 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 21 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
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
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...