This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes int and Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "int and Vector" Watch "int and Vector" New topic
Author

int and Vector

Naveen R R
Greenhorn

Joined: May 04, 2001
Posts: 20
Could anyone please help me with this? I get the following error when I try to add an int to a vector.
Error:
The method addElement invoked for type java.util.Vector with arguments () is not defined.
int persNbr = new Integer(roleAssign.getPersNbr()).intValue();
.....
.....
input.addElement(persNbr);//Error
Thank you,
Naveen
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12756
    
    5
Well of course, Vector can only hold reference variables, not primitives. You should just:
Integer iObj = new Integer(roleAssign.getPersNbr()) ;
input.addElement( iObj );
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: int and Vector
 
Similar Threads
can I add Vectors together?
Conversion of int to String in a Vector
can I add Vectors together?
Servlet Request (Integer)
can I add Vectors together?