37 Program to check input password is correct or not in Java

Code:

import java.io.*;
class Password
{
public static void main( String args[] )throws IOException
{

BufferedReader buff = new BufferedReader( new InputStreamReader( System.in ) );
String s2="1234";
String s1;
do
{
System.out.print(" Enter the password= ");
s1 = buff.readLine();

} while(! s2.equals(s1) );

if(s2.equals(s1))
System.out.println(" Password Matched Successfully ");
else
System.out.println(" Password Doesn't Successfully ");
}

}


Output:  

Previous
Next Post »