View Single Post
  #1 (permalink)  
Old 07-24-2007, 02:03 AM
toby toby is offline
Member
 
Join Date: Jul 2007
Posts: 40
toby is on a distinguished road
Problem with vectors in java
Hi, Here's my problem, I want to use vectors, in this random example i have created an object car, with a firstname of fred (told you it was random).
My question is how can i put in the System.out.println statement the code to get fred printed? I want to get the name of the car via the vector somehow. Not just car.firstName, anyone know how i would do it? I thought it would be vector.firstname.get(1) but doesn't work.

Code:
import java.io.*; import java.util.*; public class veh{ public static void main(String[] args) { Contact temp = new Contact(); Vector vector = new Vector(); Contact car = new Contact(); car.firstName = "fred"; vector.addElement(car); System.out.println(?????); } }
Thanks
Reply With Quote
Sponsored Links