File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What are Compiler time Constants?

 
siva prasaad
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is difference in the following declarations

int i=5;

int i;
i=5;

Also what are compile time constants.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Compile-time Constants from the JLS.
 
Sanjeev Singh
Ranch Hand
Posts: 381
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
siva,
What is difference in the following declarations
int i=5; //1
and
int i; i=5;//2

I am not clear about what difference you are seeking for anyway here is the difference between the two.There are various places of declarion of variable in a class body.
//1 can be declared at instance initializers,in static block,in instance block,in constructors,method body,for-loop body etc.
//2 can not be initialized as instance initializers otherwise can be initialized at the places where // can be.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic