//Program to verify a password
import java.util.*;
import java.io.*;
class Login
{
public static void main(String ahlam[])
{
String pass="Ahlam123",input;
System.out.println("Enter the Password");
Scanner scan=new Scanner(System.in);
input=scan.next();
if(pass.compareTo(input)!=0)
{
System.out.println("Invalid Password");
}
else
{
System.out.println("Vaild User");
}
}
}
/*
Output:
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>javac Login.java
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>java Login
Enter the Password
Ahlam123
Vaild User
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>java Login
Enter the Password
123A
Invalid Password
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>
*/
import java.util.*;
import java.io.*;
class Login
{
public static void main(String ahlam[])
{
String pass="Ahlam123",input;
System.out.println("Enter the Password");
Scanner scan=new Scanner(System.in);
input=scan.next();
if(pass.compareTo(input)!=0)
{
System.out.println("Invalid Password");
}
else
{
System.out.println("Vaild User");
}
}
}
/*
Output:
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>javac Login.java
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>java Login
Enter the Password
Ahlam123
Vaild User
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>java Login
Enter the Password
123A
Invalid Password
C:\Users\Ahlam\Google Drive\My Lectures\Fall\OOPM\Programs>
*/
No comments:
Post a Comment