Type the programs in NOTEPAD or DOS prompt itself, for Consol Application.
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Introduction to JAVA
before doing any JAVA Programs.
***********************************************************************************************
import java.io.*;
public class string
{
public static void main(String args[])
{
String pass,user;
try
{
DataInputStream x=new DataInputStream(System.in);
System.out.println("Enter user name :");
user=x.readLine();
System.out.println("Enter password :");
pass=x.readLine();
if(user.equalsIgnoreCase("Priyada")&&pass.equals("java"))
{
System.out.println("LOGIN");
}
else
{
System.out.println("Invalid user name or password");
}
}
catch(Exception e)
{
}
}
}
=========================================================================Output :
Here, I am giving the user name as "Priyada" and password as "java" .
In this program , only password is case sensitive.
In the output , if we give the correct user name and password, a message will appear as "LOGIN".
Otherwise , "Invalid user name or password"will be displayed.
run:
Enter user name :
priyada
Enter password :
java
LOGIN
==================================================================
Note :
We can give LOGIN table as shown below :
The program to draw table like this , will follow soon.....
No comments:
Post a Comment