Arraylist entries...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nomad
    Recognized Expert Contributor
    • Mar 2007
    • 664

    Arraylist entries...

    Hi Everyone:
    A liitle confused here about entering info in a Arraylist.

    is this how you enter data.

    call up the arraylist
    Employees = new ArrayList<Emplo yee>();

    Employee emp0 = new Employee(0);
    emp0.setid("AV1 234");
    emp0setlname("D oe");
    emp0setfname("J ohn");
    ...
    Employee emp1= new Employee(1);
    emp1.setid("AV1 235");
    emp1setlname("J ames");
    ...

    if not can you please tell me how. I have read about this an now I'm getting more confused about it.
    Many Thanks
    nomad
    PS if so where do I add the info. at the class where I made the arraylist?
    Last edited by nomad; Apr 3 '07, 09:14 PM. Reason: added more info
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by nomad
    Hi Everyone:
    A liitle confused here about entering info in a Arraylist.

    is this how you enter data.

    call up the arraylist
    Employees = new ArrayList<Emplo yee>();

    Employee emp0 = new Employee(0);
    emp0.setid("AV1 234");
    emp0setlname("D oe");
    emp0setfname("J ohn");
    ...
    Employee emp1= new Employee(1);
    emp1.setid("AV1 235");
    emp1setlname("J ames");
    ...

    if not can you please tell me how. I have read about this an now I'm getting more confused about it.
    Many Thanks
    nomad
    PS if so where do I add the info. at the class where I made the arraylist?
    You haven't added anything to the ArrayList yet. To add to the ArrayList you should use the add method. See the docs.

    Comment

    • nomad
      Recognized Expert Contributor
      • Mar 2007
      • 664

      #3
      Thanks r035198x

      I figure out the problem I was having.
      Now I discovered my Find Method is not working right and along with storing the info in the arraylist
      For some reason when I type in the info for the first time and then go back and do a find on it. It does not find it and continues on with the program.
      I have a add method (I think) ...
      Need to do some more reading...

      nomad

      Comment

      Working...