what is the difference between the following codes: 1)code one: public static void main(String []args) { final int i = 100; byte b = i; System.out.println(b); } ================================================== 2)Code two: public static void main(String []args) { int i = 100; byte b = i; System.out.println(b); } ==================================================
Check out the Java Language Specification for a formal definition:final (�4.5.4) Basically, a variable declared final is a constant -- its value cannot be changed once assigned.