This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Type mismatch: cannot convert from Image to Image[]

 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12185
34
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic