Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

(immediate)Vector Object conversion

 
Friend
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you mean how do we get a value out of it and so it be an int ?
 
Art Metzer
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic