my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Type mismatch: cannot convert from Image to Image[] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Type mismatch: cannot convert from Image to Image[]" Watch "Type mismatch: cannot convert from Image to Image[]" New topic
Author

Type mismatch: cannot convert from Image to Image[]

Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 660

Eclipse 3.6.2 is complaining that it cannot convert an Image to an Image[], and, I need to read an Image, rather than an Image[]




Further information at Java Tutorial (Oracle) - Arrays.


Jon
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

CardIcons[i] is an Image[] and you're trying to assign an Image to it. By the way: variable name should start with an lowercase letter.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11411
    
  16

if you have an egg, can you make it an egg carton?

No.

it's the same thing here. You can't just cast an Image to an Image[] as they are not the same thing.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Type mismatch: cannot convert from Image to Image[]