Fundamental program for creation & checking of account

First file should be compiled first…..then second & third.
User Id & Password will be stored temporarily as object of UserBean class.


The object of above class will be saved in usermast.dat file as the object of the above class has been serialized . The saving process will be done by the second file that is UserEntry .

The third file that is UserValid will check the valid userid & password . If any non valid userid or password is given to check it will print Invalid User.

After compilation of all the java source files the UserEntry class should be run first than for checking the valid userid & password the UserValid class should be run.

//***********First Source file*************//
import java.io.Serializable;

public class UserBean implements Serializable
{
private String login;
private String password;
public UserBean()
{
super();
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean userCheck(UserBean u)
{
boolean bool=false;
if(this.password.equals(u.getPassword()) && this.login.equals(u.getLogin()))
bool=true;
return bool;
}

}

//***********Second Source file*************//

import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;

public class UserEntry
{

public static void main(String[] args) throws IOException
{
FileOutputStream f1=new FileOutputStream(“C:\\usermast.dat”,true);/*user Id & password will be saved in this usermast.dat file*/
ObjectOutputStream os1=new ObjectOutputStream(f1);
UserBean [] ub=new UserBean[3];
for(int i=0;i


You may also like...

3 Responses

  1. madhu_vamsi says:

    Hi
    The code is not working properly and I have tried number times but no use. Any suggestions from u

    Madhu Vamsi….

  2. abhirup20002 says:

    You Please check this in your computer & after that Please tell me if doesn’t work.
    you have to install JDK 1.6 including Java Runtime Environment & compile those files. This code does not work on web.

    Now you can try. do you have java installed in your machine. I have checked this code in my own machine.

  3. madhu_vamsi says:

    Hello
    Thanks for telling me the correct Java package and it is working. This code does not work on web, it is true.

    Madhu Vamsi….

Leave a Reply

Your email address will not be published. Required fields are marked *