Please take a look at below example i cant understand the relation between char and byte
byte b = 1;
char c = 2;
c = b; // line 1
Give me compilation Error because c is type of char
and b is type of byte
so casting is must in such condition
but now the tweest here is when i run below code
final byte b = 1;
char c = 2;
c = b; // line 2
line 2 compile successfully it doesn't need any casting at all
so my question is why char
c behave different when i use final access modifier with byte
final
variables with constant expressions. i.e.byte a=1; final b=a; char c=b;
still fails. – Eindhoven