Advertisement
Guest User

Ayob UserName & Password Validation

a guest
Jan 13th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. public class FirstScanner {
  2.  
  3.     public static void main(String[] args)
  4.    
  5.     {
  6.     final String USERNAME="ayob";
  7.     final String PASSWORD="12345" ;
  8.    
  9.     Scanner GetUserCredintials= new Scanner(System.in);
  10.     boolean Fail=true;
  11.     String UserTemp="" ;
  12.     String PasswordTemp="";
  13.     do
  14.      {
  15.       System.out.print(" Insert your User Name :" );
  16.       UserTemp=GetUserCredintials.nextLine();
  17.       System.out.print(" Insert your password :" );
  18.       PasswordTemp=GetUserCredintials.nextLine();
  19.      
  20.       Fail=(((UserTemp.toLowerCase().equals(USERNAME)&&(PasswordTemp.toLowerCase().equals(PASSWORD))? false :true )));
  21.      
  22.         if( !Fail)
  23.         {
  24.           System.out.println(" You Are Login " );
  25.           break ;
  26.         }
  27.         else
  28.           System.out.println(" Wrong UserName Or Password ..Please Try Again  " );
  29.          
  30.       } while(Fail );
  31.    
  32.            
  33.    
  34.     }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement