java 导入密码
来源:百度知道 编辑:UC知道 时间:2024/05/30 01:53:17
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Password {
public static void main(String args[]) throws IOException {
String ans = "1234";
String str;
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
System.out.println("please enter password:");
str = buf.readLine();
if(str.equals(ans))
System.out.println("access successfully!");
else
System.out.println("password is wrong!");
}
}
用户名和密码都是1234
package login;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
impo