Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e6890c

Browse files
committed
File Handling
1 parent753c065 commit0e6890c

File tree

5 files changed

+86
-0
lines changed

5 files changed

+86
-0
lines changed

‎FileHandling/5_Write.java‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//File Writing :
2+
3+
importjava.io.*;
4+
5+
classFileWriting {
6+
7+
publicstaticvoidmain(String[]args)throwsIOException {
8+
9+
FileWriterfw =newFileWriter("Incubator.txt");
10+
11+
fw.write("Flutter");
12+
fw.write("BackEnd");
13+
fw.write("FrontEnd");
14+
15+
fw.close();
16+
//fw.flush();
17+
}
18+
}

‎FileHandling/6_Write.java‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//File Writing :
2+
3+
importjava.io.*;
4+
5+
classFileWriting {
6+
7+
publicstaticvoidmain(String[]args)throwsIOException {
8+
9+
Filef =newFile("Incubator.txt");
10+
FileWriterfw =newFileWriter(f);
11+
12+
fw.write("Testing\n");
13+
fw.write("Devops\n");
14+
fw.write("Salesforce\n");
15+
16+
fw.close();
17+
//fw.flush();
18+
}
19+
}

‎FileHandling/7_Read.java‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// File Reading :
2+
3+
importjava.io.*;
4+
5+
classReadFile {
6+
7+
publicstaticvoidmain(String[]args)throwsIOException {
8+
9+
FileReaderfr =newFileReader("Incubator.txt");
10+
11+
intdata =fr.read();
12+
13+
while(data != -1) {
14+
15+
System.out.print((char)data);
16+
data =fr.read();
17+
}
18+
19+
fr.close();
20+
}
21+
}

‎FileHandling/8_Read.java‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// File Reading :
2+
3+
importjava.io.*;
4+
5+
classReadFile {
6+
7+
publicstaticvoidmain(String[]args)throwsIOException {
8+
9+
FileInputStreamfir =newFileInputStream("Incubator.txt");
10+
11+
FileDescriptorfd =fir.getFD();
12+
13+
FileReaderfr =newFileReader(fd);
14+
15+
intdata =fr.read();
16+
17+
while(data != -1) {
18+
19+
System.out.print((char)data);
20+
data =fr.read();
21+
}
22+
23+
fr.close();
24+
}
25+
}

‎FileHandling/Incubator.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Testing
2+
Devops
3+
Salesforce

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp