Thread: vector - get
View Single Post
  #1 (permalink)  
Old 01-02-2009, 03:46 AM
natdizzle natdizzle is offline
Member
 
Join Date: Jan 2009
Posts: 1
Rep Power: 0
natdizzle is on a distinguished road
Default vector - get
Hi,

I'm trying to return the name of an object that I have added to a vector. I'm using

Code:
Vector<animal> cats = new Vector<animal>();
		cats.addElement(new cat(0));
		System.out.println("Type of object " + cats.get(i));
But this returns:
Type of object arrayofobjects$cat@10b30a7

And I need it to return something more like "Type of object: Cat"

how can I do this?

Thanks,
Nate
Reply With Quote