File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What are Compiler time Constants? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What are Compiler time Constants?" Watch "What are Compiler time Constants?" New topic
Author

What are Compiler time Constants?

siva prasaad
Greenhorn

Joined: Jan 10, 2007
Posts: 23
What is difference in the following declarations

int i=5;

int i;
i=5;

Also what are compile time constants.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Compile-time Constants from the JLS.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Sanjeev Singh
Ranch Hand

Joined: Nov 01, 2006
Posts: 381
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.


~Sanjeev Singh<br />SCJP 1.5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What are Compiler time Constants?