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:

  1. Integer j = null;
    int i;
    i = j;


    ??

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

    ReplyDelete