Sama Willson wrote:Why is that? and what does it mean?
Short answer: although a
short can be assigned to an
int, a
Short and an
Integer are incompatible types (like for example a
Cat and a
Dog). And the compiler prevents you from comparing two incompatible types, because these will
never be equal to each other! That's a fairly common mistake.
In
this topic you'll learn everything you need to know (and probably even more) about wrapper classes and the
== operator (with a boatload of code snippets). Definitely worth reading!
Hope it helps!
Kind regards,
Roel