Java 无法解析变量?
小白自学,不知错在哪里请大神指教Exceptioninthread"main"java.lang.Error:Unresolvedcompilationproblem:p...
小白自学,不知错在哪里请大神指教Exception in thread "main" java.lang.Error: Unresolved compilation problem: pw2 cannot be resolved to a variable源代码:import java.util.Scanner;public class Doc { String Psd = "0"; public static void main(String []args) { Scanner sc = new Scanner(System.in); Boolean Cheeking = true; Boolean Cheek2 = true; while(Cheeking) { System.out.println("请输入您的密码"); String Psd = sc.nextLine(); int Psdsize = Psd.length(); //密码字符数判断 if(Psdsize>=6 && Psdsize<=11) { Cheeking = false; }else if(Psdsize < 6) { System.out.println("Password is to short"); }else { System.out.println("Password is to long"); } //二次密码比对 do { System.out.println("请确认密码"); String pw2 = sc.nextLine(); if(!Psd.equals(pw2)){ System.out.println("Password set UNsuccessfully"); } }while(!Psd.equals(pw2)); } }}
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询