- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFile.java
More file actions
Latest commit
26 lines (26 loc) · 605 Bytes
/
Copy pathFile.java
File metadata and controls
26 lines (26 loc) · 605 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Write a file handling programming with reader/writer
importjava.io.*;
classFile
{
publicstaticvoidmain(Stringargs[])
{
try
{
FileReaderfr=newFileReader("testing.txt");
FileWriterfw=newFileWriter("copy.txt");
BufferedReaderbr=newBufferedReader(fr);
Stringstr;
while((str=br.readLine())!=null)
{
System.out.println(str);
fw.write(str);
}
fr.close();
fw.close();
}
catch(IOExceptione)
{
System.out.println(e.getMessage());
}
}
}