Originally posted by Arek Orzechowski:
Hi,
....
this compiles ok:
I agree with you that the code will compile, because Number is superclass of Integer and Double. Since we are talking of compilation it's ok.
I will just add that the code will throw a ClassCastException if you don't turned 123 into a double even if it compiles.