aspose file tools*
The moose likes Beginning Java and the fly likes Java.lang.object error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java.lang.object error " Watch "Java.lang.object error " New topic
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: 14688
    
  16

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java.lang.object error