File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "(immediate)Vector Object conversion" Watch "(immediate)Vector Object conversion" New topic

(immediate)Vector Object conversion

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.
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.
ryan burgdorfer
Ranch Hand

Joined: Jan 24, 2001
Posts: 219
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?
[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:
subject: (immediate)Vector Object conversion
It's not a secret anymore!