I found something strange. Please review the code below:
final int i = 100;
byte b = i;
System.out.println(b);
Output:
Removing the final keywords, causes exception.
int i = 100;
byte b = i;
System.out.println(b);
Output:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from int to byte
What is the reason? What role final keywords plays here?
Thanks.