This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes (immediate)Vector Object conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "(immediate)Vector Object conversion" Watch "(immediate)Vector Object conversion" New topic
Author

(immediate)Vector Object conversion

Friend
Ranch Hand

Joined: Nov 23, 2000
Posts: 67
Please give immediately how to conert Vector object to an integer? We can convert integer to object by using
"v.add(new Integer(vx));" But the reverse?
Please give the answer today if possible.
Thank you.
Jyotsna.
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
do you mean how do we get a value out of it and so it be an int ?


Val SCJP <BR>going for SCJD
Art Metzer
Ranch Hand

Joined: Oct 31, 2000
Posts: 241
Hi, Jyotsna.
Is this something like what you had in mind?

The line of interest is

I hope this helps, Jyotsna.
Art
ryan burgdorfer
Ranch Hand

Joined: Jan 24, 2001
Posts: 219
Art,
In your example, why do you need to use the inValue() method when retrieving the int out of the vector? Isn't it enough to simply cast the object to an Integer?
Also, why bother trying to catch the exception, when your for loop is precisely the size of the vector?
Thanks,
~Ryan
[This message has been edited by ryan burgdorfer (edited February 01, 2001).]


<UL TYPE=SQUARE><I><LI>Ryan Burgdorfer<BR><LI>Java Acolyte</I></UL>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: (immediate)Vector Object conversion
 
Similar Threads
Using add on Vector<?>
Generics Question - Reference type
URGENT : TYPE CASTING PROBLEM
How to iterate vector of vector objects ?
Please Help: Putting Vector objects into HashMap