forked from serkanhelvacioglu/Java-IAU
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFileIO.java
More file actions
52 lines (24 loc) · 802 Bytes
/
FileIO.java
File metadata and controls
52 lines (24 loc) · 802 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package pack1;
import java.io.*;
import java.util.Scanner;
public class FileIO {
public static void main(String[] args) throws IOException {
File file1 = new File("e:\\users\\ssener\\desktop\\javaIO.txt");
file1.createNewFile();
FileWriter fwrite = new FileWriter(file1);
fwrite.write("JAVA Programming\n");
fwrite.write("Object Oriented\n");
fwrite.write("Computer Programmingn\n");
fwrite.flush();
fwrite.write("Extra Information\n");
fwrite.flush();
BufferedWriter bfwrite = new BufferedWriter(fwrite);
bfwrite.newLine();
bfwrite.write("This is from BufferedWriter\n");
bfwrite.close();
Scanner scan = new Scanner(file1);
while(scan.hasNext()){
System.out.println(scan.nextLine());
}
}
}