aspose file tools*
The moose likes Beginning Java and the fly likes final variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "final variables" Watch "final variables" New topic

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;
2)Code two:
public static void main(String []args)
int i = 100;
byte b = i;
Jessica Sant

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
I agree. Here's the link:
subject: final variables
Similar Threads
Primitive assignment
Tell me Why ?
Conversions with final keyword please helpme understand
automatic primitive conversion from higher to lower precision?????
What is the output for First Snippet and Second Snippet?