File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: (immediate)Vector Object conversion
 
Similar Threads
URGENT : TYPE CASTING PROBLEM
How to iterate vector of vector objects ?
Using add on Vector<?>
Generics Question - Reference type
Please Help: Putting Vector objects into HashMap