create push(Object obj) using stack?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ben Wan

    create push(Object obj) using stack?

    if I want to create a NameList where it only hold names...
    is there a good way to write the pushGirl(Object obj) and pushGuy(Object obj)?
    here's how I want to use it...

    PeopleList people = new PeopleList();
    people.pushGuy( "John");
    people.puthGirl ("Marry");

    so, for example, do I write it like this?
    public void pushGuy(Object obj) {
    String name = new String( (String)obj ); // or String name = (String)obj; ??
    // then what else should I do? thx...
    }


    Thx a thousand times...
    Ben


Working...