The key concept here is binary numeric promotion.
When you supply an operator with operands of different types, the operands have to be are converted to be compatible with one another. The conditional operator's rules for this conversion are reasonably complicated; but when the operands are of differing types, and are convertible to numbers, binary numeric promotion is applied.
In the case of supplying one boxed and one primitive operand, the effect of binary numeric promotion is to attempt to unbox the boxed operand, not to box the primitive operand.
You get can observe binary numeric promotion with other multi-operand operators, for example +
:
System.out.println(1 + (Integer) null); // NullPointerException!
With the conditional operator, you would not get a NPE if you explicitly box the 1, because the operands are then not of differing types:
Integer n = obj[0] == null ? (Integer)obj[0] : Integer.valueOf(1);