File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

final variables

 
Anirban dutta
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4313
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic