Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

int and Vector  RSS feed

 
Naveen R R
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well of course, Vector can only hold reference variables, not primitives. You should just:
Integer iObj = new Integer(roleAssign.getPersNbr()) ;
input.addElement( iObj );
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!