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.
thanks
int Prefnum=0; int Arefnum=0; int Pserial=0; double Pvalue=0;
Prefnum=Integer.parseInt(proceedingsList[0]).toString(); //incompatible type
and also tried
int Prefnum=0; Prefnum=String.valueOf(proceedingsList[0]); //incompatible type
what am i missing here?
thanks
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35221
7
posted
0
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[0]);
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 ]