Quote:
Originally posted by CornedBee
I suggest putting braces around the for-block, that could be the source of the error.
Btw, I think that's consistent with C++'s behaviour ;)
For converting a single int to double, you can just assign it, the conversion ought to be done implicitely. If not, you can cast it explicitely:
double d = (double)i;
or use the Integer class:
double d = new Integer(i).doubleVal();
(yuck!)
I tried the first method there. With (double). But I got the same error. The thing is that I revers engineered the java package my teacher had made, to edit his code so it could be used for this assignment. So the for block was all ready there. Right before I left for work I saw he had skipped the { } after the for statement, and managed to pull it of with the (double), just didn't have the time post a reply. But thanks for the other method to. I hate that it has to be so complicated to cast datatypes. "Integer(i).doubleVal();" this should not be nessesary to do. Well, at least it is an other way to do it. Thanks for the reply. See you around.