java替换加密_我想把密码替换成*******这符号,但我不知怎么去实现-----------------大家请进...

得分:10

ca56232b3bbedf9a539d07f37fffb99a.gif

3144d8b7615c79d9f638db40d5689d26.gif

a218af6549b45ee526caf607ebff1358.gif

0f8df0e29816ae721419de940fb833d1.gif

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();

}

}

}

}

6f83fddf9cb9ff6843fffd45e1807199.gif

你的优秀和我的人生无关!!!!

我要过的,是属于我自己的生活~~~

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值