title: Where to throw exception handles?
body: <p>I'm trying to write a class that does data validation as the user enters data for the instance variables. There is no main method in this class only constructors. User input is done in a test harness. My question is do I do the exception handling in the set methods as I have done here? or should I do a try and catch in one of the constructors?</p>
  
  <pre><code>public class Customer
  {
    private String fName;
    private String lName;
    private String custTIN;
    private int custNbr;
    private int custHonor;
  
    public Customer(String first, String last, String tin, int cust, int honor)
    {
      setFName(first);
      setLName(last);
      setCustTIN(tin);
      setCustNbr(cust);
      setCustHonor(honor);
    }
  
    public Customer(String first, String last, int cust, String tin)
    {
      setFName(first);
      setLName(last);
      setCustTIN(tin);
      setCustNbr(cust);
    }
    /**************************************************************************************************************
      * Set &amp; Get Methods
     **************************************************************************************************************/
  
    public void setFName(String first) throws InvalidCustomerException
    {
      if(first == "null")
      {
       throw new InvalidCustomerException("You did not enter any data");
      }
         else
         {
          fName = first;
         }
    }
  
    public void setLName(String last)
    {
     lName = last;
    }
  
    public void setCustTIN(String tin)
    {
     custTIN = tin;
    }
  
    public void setCustNbr(int cust)
    {
     custNbr = cust;
    }
  
    public void setCustHonor(int honor)
    {
     custHonor = honor;
    }
  
    public String getFName()
    {
     return fName;
    }
  
    public String getLName()
    {
     return lName;
    }
  
    public String getCustTIN()
    {
     return custTIN;
    }
  
    public int getCustNbr()
    {
     return custNbr;
    }
  
    public int getCustHonor()
    {
     return custHonor;
    }
  
    /****************************************************************************************************************
      * toString Methods
     ****************************************************************************************************************/
    //public String createSalutaion()
    {
    }//end createSalutation()
  
  
    public String toString()
    {
      return String.format ("%d %s %s, Customer number %d, with Tax Id: %s", getCustHonor(), getFName(), getLName(), getCustNbr(), getCustTIN());
    }//end toString()
  
  }
  </code></pre>
  
  <p>Here is my exception class.....</p>
  
  <pre><code>/**
   * Auto Generated Java Class.
   */
  public class InvalidCustomerException extends Exception
  {
    private String inputValue = "null";
  
    public InvalidCustomerException(String message) 
    { 
     super(message);
    }
  
    public InvalidCustomerException(String message, Throwable cause)
    {
     super(message,
          cause);
    }
  
    public InvalidCustomerException(String message, String inputValue)
    {
  
    }
  
    public InvalidCustomerException(String message, String inputValue, Throwable cause)
    {
  
    }
  
  
  } // end of invalid customer exception 
  </code></pre>