文档的修改

文档如下

scose=88
age=111
name=张三
id=3

  修改的编程

package 汉化包;

import java.io.FileReader;
import java.lang.reflect.GenericArrayType;
import java.util.Properties;

import javax.swing.JOptionPane;

public class in {
	public static void main(String[] args) {
		Properties pro = new Properties();
		try {
			pro.load(new FileReader("user.txt"));
		} catch (Exception e) {
			System.out.println("文件不存在");
		}
		for (int i = 0; i < 3; i++) {
			String a = pro.getProperty("userName"); 
			
			String s = JOptionPane.showInputDialog(null, "请输入账号");
			String y = JOptionPane.showInputDialog(null, "请输入密码");

			if (a.equals(s) && pro.getProperty("pwd").equals(y)) {
				JOptionPane.showMessageDialog(null, "登陆成功");
				break;
			} else {
				JOptionPane.showMessageDialog(null, "登陆失败");

			}
		}
	}
}

  

posted on 2018-04-01 18:51  简末  阅读(117)  评论(0编辑  收藏  举报

导航