Class vector, help.

Discussion in 'Java' started by Arturo Parisi, Sep 6, 2004.

  1. I have created the class Room. I'd create e vector of Room.
    I declare a vector in this way:

    Vector v = new Vector();

    Room uno = new Room();
    Room due = new Room(1, "aldo", "pollo", "sempronio");

    v.add(uno);
    v.add(due);

    But if I want to do v.get(0).setName("OK"); the compiler gives me an error.
    The vector that I have created is generic, how can I create a Room Vector?
    Thanks.
    Arturo Parisi, Sep 6, 2004
    #1
    1. Advertising

  2. On Mon, 06 Sep 2004 16:37:49 GMT, Arturo Parisi wrote:

    > I have created the class Room.


    You have also multi-posted*, please
    see my answer on the other group.

    Please also refrain from multi-posting..
    * <http://www.physci.org/codes/javafaq.jsp#netiquette>

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
    Andrew Thompson, Sep 6, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ding feng
    Replies:
    8
    Views:
    840
    Dhruv
    Jul 2, 2003
  2. pmatos
    Replies:
    6
    Views:
    23,735
  3. Replies:
    8
    Views:
    1,895
    Csaba
    Feb 18, 2006
  4. Javier
    Replies:
    2
    Views:
    548
    James Kanze
    Sep 4, 2007
  5. Rushikesh Joshi
    Replies:
    0
    Views:
    349
    Rushikesh Joshi
    Jul 10, 2004
Loading...

Share This Page