I wrote the following line of code in AIDE some times ago while learning Java, saw it again tonight and I was baffled
Integer aaa = Integer.sum(new Integer(9),new Object())
I ain't drunk actually (and should know that the sum method of the Integer class doesn't take an Object as a parameter) but what makes feel like I do is the fact that the IDE compiles the code and run it.
A ClassCast exception was thrown which gives the impression that the IDE probably downcast the object as such the code that get run under the scene is probably
Integer aaa = Integer.sum(new Integer(9),(Integer) new Object())
but who does that?? All my life I believe DownCasting was never meant to be automatic or I am probably missing something?
I could easily tell myself it's a bug in the IDE or something like that but that would make me a fool who guesses rather thank ask question. Please what am I missing here??
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…