PDA

Click to See Complete Forum and Search --> : help with this ?


alistair4267
Jun 7th, 2003, 07:54 AM
hi

i need help with this calculator i am working on in java. i don't understand why it isn't working

C:\Documents and Settings\Kole\My Documents\Programming\Java\Calculator\Assignment\Kalkulator.java:409: double cannot be dereferenced
sX = dX.toString();
^
1 error
Exit code: 1
There were errors


:confused:

Phenglai
Jun 7th, 2003, 08:44 AM
I am just learning java so I amy have this wrong but I pretty sure this code


sX = dX.toString();


should read


sX = String.ValueOf(dX).toString();


I got the same error you did so I change the above line of code to wrap the String class.

Hope that helps,

Jerel

Dillinger4
Jun 7th, 2003, 12:50 PM
public static String valueOf(double d) returns a String so there is no need to add in the extra toString().