As far as I understand, variable evaluation is done at run time. However, type evaluation is done at compile time in Java.
Also as I see, making a variable constant (I am using local variables but it changes nothing about the concept above), will make its value known at compile time.
I provide you two examples to test this concept. The first is working and the second is not.
Could someone explain to me why making the variable constant allows me to assign a short variable to an int variable, whereas I cannot assign an int variable to a long?
// Working example
final int x = 10;
short y = x;
// Non-working example
final long a = 10L;
int b = a;