Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

incompatible type error

Status
Not open for further replies.

rabix

Programmer
Apr 23, 2001
12
CH
hi,
i am trying to put some integer vales from the instance of a class to a List by

List sexList=new ArrayList();
sexList.add(Integer(PersonBean.getSex())); in a jsp page. but when i run the page i get an

error
Icompatible type for method. Can't convert double to java.lang.Object.
EndPensionList.add(BVGInsuredBean.getOldAgePension());
how can i avoid this error.
the getsex() method returns an integer.
thanx
Rabix
 
if getsex() returns type int, then just use the Integer wrapper class to convert to an object. You're already doing that to a certain extent.. but you're forgetting to instantiate the object.<br><br>List sexList = new ArrayList();<br>sexList.add(new Integer(PersonBean.getSex()));<br><br>I hope that solves your problem. <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top