aspose file tools*
The moose likes Beginning Java and the fly likes What is Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is "compile-time constant"?" Watch "What is "compile-time constant"?" New topic
Author

What is "compile-time constant"?

Woo Hwang
Greenhorn

Joined: Aug 07, 2001
Posts: 13
I'm reading "Getting in touch with your Inner Class" article, I encounter a term reading a paragraph blow:
Another warning about all inner classed is that that can't declare ant static members unless they are compile-time constant and are promitives or Strings( This does not apply to static nested classed, of course)
I don't know what is compile-time constant. Can anybody tell me what it is?
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Woo,
Any variable defined as final is considered to be a compile-time constant. The compiler will actually place its code in-line wherever it is used.

Regards,
Manfred.
Woo Hwang
Greenhorn

Joined: Aug 07, 2001
Posts: 13
Thank you for your reply. Now I understand that. But I don't know what is like "place its code in-line" . Sorry, Engllish is not my native one.
Thank you
Woo
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

Think of it as a macro.
The compiler will convert MEMBER_VAR to 14. So when the code is executed you don't have a variable, you have a value (for MEMBER_VAR).


Please ignore post, I have no idea what I am talking about.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is "compile-time constant"?