Class vector, help.

A

Arturo Parisi

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top