得分:10
import java.util.*;
public class Accp9_3 {
public static void main(String[] args) {
System.out.println("--欢迎进入学员注册系统--");
Scanner input=new Scanner(System.in);
System.out.print("请输入您的账号:");
String zhanghao=input.next();
EraserThread eraserThread = new EraserThread(); //启动线程
eraserThread.start();
System.out.print("请输入您的密码:");
String possword1=input.next();
System.out.print("请确认您的密码:");
String possword2=input.next();
eraserThread.setActive(false); //结束线程
if (possword1.equals(possword2)){
String mima=possword1=possword2;
System.out.println("恭喜您,注册成功!!!");
System.out.println("您的账号是: "+zhanghao + "您的密码是: "+mima+"\n请记好的您的账号和密码,以防遗忘!!! ");
}else{
System.out.println("密码不一致,请重新注册!!!");
}
}
}
class EraserThread extends Thread {
private boolean active;
private String mask;
public EraserThread() {
this('*');
}
public EraserThread(char maskChar) {
active = true;
mask = "\010" + maskChar;
}
public void setActive(boolean active) {
this.active = active;
}
public boolean isActive() {
return active;
}
public void run() {
while(isActive()) {
System.out.print(mask);
try {
Thread.currentThread().sleep(50);
} catch(InterruptedException e) {
e.printStackTrace();
}
}
}
}
你的优秀和我的人生无关!!!!
我要过的,是属于我自己的生活~~~