| Author |
Java.lang.object error
|
G. Graz
Ranch Hand
Joined: Oct 23, 2006
Posts: 30
|
|
I am bit confused on a part of code that I am working on. I am grabbing ArrayList data and then putting it into an Array to compute the average value of that Array , I keep on getting the following error message " Operator cannot be applied to double, java.lang.object" during my sum += average[i], Anyway the way I have the loop structured should be correct , I do not know what I am missing to cause the error ? Any ideas ? Thank you.
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14669
|
|
|
score is an ArrayList of Double, isn't it. Look at the API for ArrayList#toArray. Why did you declare the average array as an array of Object ?
|
[My Blog]
All roads lead to JavaRanch
|
 |
G. Graz
Ranch Hand
Joined: Oct 23, 2006
Posts: 30
|
|
|
ok, thank you ! I got it ! I was a bit confused by the API when I first looked at it . Thank you again.
|
 |
 |
|
|
subject: Java.lang.object error
|
|
|