| Author |
final variables
|
Anirban dutta
Ranch Hand
Joined: Aug 08, 2002
Posts: 89
|
|
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); } ==================================================
|
 |
Jessica Sant
Sheriff
Joined: Oct 17, 2001
Posts: 4313
|
|
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.
|
- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
|
 |
 |
|
|
subject: final variables
|
|
|