About Question enthuware.ocajp.i.v8.2.1247 :
Posted: Thu Mar 23, 2017 4:03 pm
In the answer to this question it says:
I also tried
So it seems to me that the constant expression is also allowed to be char or short. It doesn't have to be int.
Am I missing something?
But I tried the following and it worked without problems:A narrowing primitive conversion may be used if all of the following conditions are satisfied:
1. The expression is a constant expression of type int.
Code: Select all
final char c = 5;
byte b = c;
Code: Select all
final short s = 5;
Am I missing something?