怎么用eclipse编写对输入的密码进行核对的代码

2025-04-16 07:04:31

1、第一步打开eclipse

2、输入代码,注意符号必须是在英文状态下,该大写的内容不要小写了哦。

3、import java.util.Scanner;public class name {public static void main(String[] args) {Scanner sc= new Scanner(System.in);String qwd1="0";String qwd2="0";do { System.out.println("请输入密码:"); qwd1=sc.nextLine(); System.out.println("请再次输入密码:"); qwd2=sc.nextLine(); if(!qwd1.equals(qwd2)) { System.out.println("密码不一致,请重新输入");}}while(!qwd1.equals(qwd2));System.out.println("密码一致,通过。");}}

http://v.youku.com/v_show/id_XNDAwNzcwNTUwMA==.html?spm=a2h3j.8428770.3416059.1

4、点击保存,点击运行,在控制台输入内容,检测结果。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢