2009-06-19

More puzzling behaviour

Still in the spirit of Java Puzzlers; can you provide declarations for i and j to make this statement fail at runtime?

i = j;


I spent quite some time debugging this, once...

2 comments:

Anonymous said...

Integer j = null;
int i;
i = j;


??

espenhw said...

Quite right. Any other boxed primitive/primitive pair would work just as well.