Developer's Daily Java Education - Test Projects
  front page | java | perl | unix | DevDirectory
   
Front Page
Java
Education
   
 



public class User
{
  public int numUsers = 0;
  private String name;

  public User(String name)
  {
    this.name = name;
    numUsers++;
  }

  public String getName()
  throws NoNameException
  {
    if ( (name==null) || (name.trim().length()==0) )
    {
      throw new NoNameException("Don't know anything about ___");
    }
    else
    {
      return name;
    }
  }

  public void setName(String name)
  {
    this.name = name;
  }
}
Copyright 1998-2003 DevDaily Interactive, Inc.
All Rights Reserved.