|
Though the value which you have declared is a final Integer constant, there are possibilities of that value holding null as its value which is error prone when given in a case statement. In your case, the variable holds a value. So, you might think like, why not autoboxing can take place? But the same variable can be assigned to null too. In that scenario, the conversion of autoboxing results in NPE. So to avoid such erroneous situations, such usages are not recommended and it s strictly avoided in the compile time itself.
|
|