uj5u.com熱心網友回復:
你是需要幫你寫完全部的代碼嗎
uj5u.com熱心網友回復:
對的,麻煩了
uj5u.com熱心網友回復:
c主要還是什么uj5u.com熱心網友回復:
c語言還是javauj5u.com熱心網友回復:
File file = new File("lyingFileRead.txt");// 錄入資料
FileOutputStream out = new FileOutputStream(file);
String str = "張三,123456";
out.write(str.getBytes());
out.close();
// 讀取資料
FileInputStream in = new FileInputStream(file);
InputStreamReader reader = new InputStreamReader(in);
BufferedReader br = new BufferedReader(reader);
String line = "";
if ((line = br.readLine()) != null) {
System.out.print("輸入: ");
Scanner input = new Scanner(System.in);
String data = input.nextLine();
// 拆分資料
String username = line.split(",")[0];
String password = line.split(",")[1];
String data_name = data.split(" ")[0];
String data_password = data.split(" ")[1];
if (username.equals(data_name) && password.equals(data_password)) {
System.out.println("歡迎登錄");
} else {
System.out.println("用戶名或密碼錯誤");
}
input.close();
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/26046.html
標籤:Java SE
下一篇:Visual Studio
