I have declared the following values as int and double but my problem is that I�ve created an array which returns a string which means since Prefnum is declared as an int then it will have to be converted to a string, now do I used String.valueOf or toString to convert so I can print out these values as strings? The error that i'm getting when using either one of the two is incompatible data type.
int Prefnum=0; int Arefnum=0; int Pserial=0; double Pvalue=0;
Either "String.valueOf(Prefnum)" or "(new Integer(Prefnum)).toString()" should work.
Joined: Jan 14, 2005
i've tried it like this...
Prefnum=Integer.parseInt(proceedingsList).toString(); //incompatible type
and also tried
int Prefnum=0; Prefnum=String.valueOf(proceedingsList); //incompatible type
what am i missing here?
Joined: Mar 22, 2005
1) Integer.parseInt takes a String as parameter, not an int, and it returns an int, which is not an object, and thus does not have a toString method.
2) String.valueOf returns a String, not an int.
Try int Prefnum = Integer.parseInt(proceedingsList);
If you're in doubt what kind of parameter a method accepts, or what kind of value it returns, you can check the javadocs for java.lang.Integer and java.lang.String. [ August 29, 2005: Message edited by: Ulf Dittmer ]