View Single Post
Old 08-04-2004, 04:31 PM   #1 (permalink)
DKasler
 
Newb Techie

Join Date: Mar 2004

Posts: 36

DKasler

Send a message via AIM to DKasler Send a message via Yahoo to DKasler
Default Java programming problem with For Loop

Can anyone tell me what is wrong with this For Loop?

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[];
      }
 
      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
    }
}

DKasler is offline