View Single Post
Old 08-05-2004, 08:01 AM   #3 (permalink)
Iron_Cross
 
Ultra Techie

Join Date: Sep 2003

Location: Bamberg, Germany

Posts: 549

Iron_Cross

Send a message via ICQ to Iron_Cross Send a message via MSN to Iron_Cross Send a message via Yahoo to Iron_Cross
Default

Try this:
Code:
public class EmployeeApplication
{
   public static void main(String[] args)
    {
      //define variables
      Employee obj;   //the object of Employee class
      String sSource = args[0]; 
      /* if you have multiple inputs you can use for loop
      * to take all inputs one by one
      */
     for( int i = 0; i < sSource.length(); i++)
      {
        obj = sSource[i];
      }
 
      String s1 = sSource.substring(0, 11);  //SSN
      String s2 = sSource.substring(12,sSource.length()); //Name
 
      //create an instance of each variable
      obj = new Employee();
 
      //calling the methods of the first object
      obj.setsEmpId(s1);
      obj.setsEmpName(s2);
 
      System.out.println(obj); //toString is automatically called
    }
}
See if that works, all I did was change this line:
obj = sSource[i];
I added the i.
__________________

See today\'s Penny-Arcade!(May contain foul lanuage)
Pain is weakness leaving the body.

PM Me for my MSN
Iron_Cross is offline