File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes file io Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

file io

mike hengst
Ranch Hand

Joined: Oct 19, 2002
Posts: 43
I am having a problem figuring exactly what I need to do on this problem. I want to read in a file, place it in an array. After that it needs to be sent to a class that calculates the charge. The second part is supposed to output the results to another file(txt). I think I have the first part down. What I am wondering is how does one instantiate an object array, place the results into the appropiate array and then take that and print to a text file???Here is the code I have so far, any help will keep me from freakin' out...

[ December 14, 2002: Message edited by: mike hengst ]

Thank you Oh Lord<br />For the white blind light<br />A city rises from the sea<br />I had a splitting headache<br />from which the future's made<br />--morrisson
Viet Nguyen

Joined: Dec 14, 2002
Posts: 1
I think you need a Printwriter in the try and catch block to print the results to the .txt files
for Example
PrintWriter out = new PrintWriter(new FileWriter(outFile.txt));
All you codes goes here.
}catch(IOException e)

mike hengst
Ranch Hand

Joined: Oct 19, 2002
Posts: 43
I have been working on this all afternoon and I have changed my code to inlcude the PrintWriter stuff. i just don't think I am doing it right. Here is my ammended code. Maybe you or someone else can see what I am doing wrong, or not doing at all.
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Continued here.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: file io
It's not a secret anymore!