• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

(immediate)Vector Object conversion

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