|
-
Feb 7th, 2007, 01:22 AM
#1
Thread Starter
Junior Member
How to read and write files using java?
i'm trying to read and write files using java...
some errors occurs when i'm trying this code..
Error in java: Cannot find symbol
location: class java.io.FileOutputStream
FileOutputStream fout = new FileOutputStream(outputFile);
^
import java.io.*;
public class Copy {
public static void main(String[] args) throws IOException {
// create two file references
File inputFile = new File("D:/1.txt");
File outputFile = new File("D:/2.txt");
// create two File Streams
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
// read one file and write it out to another
int c;
while ((c = in.read()) != -1)
out.write(c);
// close both files
in.close();
out.close();
}
}
What i have to do for this?
now only i'm learning java...
thats y...
senthil.
-
Feb 7th, 2007, 06:42 AM
#2
Re: How to read and write files using java?
1) Use code tags.
2) The line that gives you the error does not appear in what you posted.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|