-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputOutputTXT.java
More file actions
41 lines (35 loc) · 1.09 KB
/
InputOutputTXT.java
File metadata and controls
41 lines (35 loc) · 1.09 KB
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
package StreamFile;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
public class InputOutputTXT implements Closeable{
/*
* 1.����ı����ļ�
* 2.���ı�
*
* */
public static void main(String[] args) {
//try-with-catch--���
try( Scanner in=new Scanner(new FileInputStream("src\\readme.txt"));
PrintWriter out= new PrintWriter("src\\readme.txt")){
//PrintWriter out=new PrintWriter(new FileWriter("readme.txt"),true);
//������д���ļ�д��true�����Զ�ˢ��
//��ӡ��д����
out.println("name");
out.print("password");
out.println(100);
out.flush();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void close() throws IOException {
// TODO Auto-generated method stub
System.out.println("�ر�����/�����");
}
}