do while 用do while语句写一个程序题目为:输入密码直到正确 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 假设100的为争取的密码int password=0;do{password++;}while(password==100)system.out.prinln("密码正确")其实看到这个条件后很晕,给的要求太少了 2楼你给的是个啥啊?供参考:String correct = "123456";Scanner sc = new Scanner(System.in);while (true) { String inp = sc.nextLine(); if (corrent.equals(inp)) break; System.out.println("Wrong");}System.out.println("Correct"); 谢谢啦!可以给我一些学JAVA的建议吗? System.out.println("请输入密码!"); byte[] bytes = new byte[1024]; InputStream i; String str; do { i = System.in; int m = i.read(bytes); str = new String(bytes, 0, m); if(str.equals("passwd\r\n")){ System.out.println("欢迎登陆!"); break; }else{ System.out.println("密码错误"); } } while(str!=null && !str.equals("")); java对象实例(instance)如何访问 JAVA生成EXE文件 如何加载第三方JAR包 关于判断对象的类 求教 请问java中this的这种用法?DnDExample.this.dispose() 麻烦大哥级的朋友帮小弟做一下期末考试复习题`` java如何开发wizard程序? 刚学java不久,请教一个关于break的简单问题 为什么老报java.lang.NullPointerException 的错!!??(急) 如何把string类型的转化成int类型的? [求助]识别网站有无SSL java游戏服务器
int password=0;
do{
password++;
}while(password==100)
system.out.prinln("密码正确")
其实看到这个条件后很晕,给的要求太少了
Scanner sc = new Scanner(System.in);
while (true) {
String inp = sc.nextLine();
if (corrent.equals(inp)) break;
System.out.println("Wrong");
}
System.out.println("Correct");
byte[] bytes = new byte[1024];
InputStream i;
String str;
do
{
i = System.in;
int m = i.read(bytes);
str = new String(bytes, 0, m);
if(str.equals("passwd\r\n")){
System.out.println("欢迎登陆!");
break;
}else{
System.out.println("密码错误");
}
}
while(str!=null && !str.equals(""));