package charstream1;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class ScannerChar {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
System.out.println("请输入用户名");
String sname = sc.next();
System.out.println("请输入密码");
String password = sc.next();
FileWriter fw = new FileWriter("charstream\\user");
// 把用户名和密码写到文件中
fw.write(sname);
fw.write("\r\n");
fw.write(password);
fw.write("\r\n");
// 刷新流
fw.flush();
// 释放资源
fw.close();
}
}
【笔记】用户信息存取
最新推荐文章于 2024-11-15 18:38:47 发布