package test;
import java.io.Console;
public class Test
{
public static void main(String[] args)
{
Console console=System.console();
char[] psw=console.readPassword("Enter Password"); // Reading Password
char[] pswd={'a'}; // Variable to compare password entered
System.out.println(psw);
if(psw.equals(pswd)) // Here i do not understand how to verify password correctly?
{
System.out.println("Ok");
}
}
}
我希望正确使用Console类,但我无法这样做。如果你理解我的错误,请更正代码。
答案 0 :(得分:1)