-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractical_37.java
More file actions
29 lines (26 loc) · 905 Bytes
/
Practical_37.java
File metadata and controls
29 lines (26 loc) · 905 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
27
28
29
/* Question := Write a program to copy the content of one file to another file. */
import java.io.*;
import java.util.*;
class Practical_37{
public static void main(String[] arg) throws Exception {
Scanner sc = new Scanner(System.in);
System.out.print("Enter source file name := ");
String source = sc.nextLine();
System.out.print("Enter destination file name := ");
String destination = sc.nextLine();
FileReader fin = new FileReader(source);
FileWriter fout = new FileWriter(destination, true);
int c;
while ((c = fin.read()) != -1) {
fout.write(c);
}
System.out.println("Copy finish...");
fin.close();
fout.close();
}
}
/* Output :=
Enter source file name := Jainam
Enter destination file name := Study
Copy finish...
*/