The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.



Posted by Kishori Sharan on December 19, 2000 at 11:27 AM

I think all instance variables including "final" ones are created on heap along with the object. The Jave Virtual Machine Specification as well as Java Language Specification has specifically mentioned about class constant pools when they talk about static final variables. But in case of object creation they always say, "New object contains new instances of all fields declared in the class...". One more thing is that even if the variable is declared as final it is still instance variable so it should be created along with the object and then heap is the proper place not the constant pool of the class.



Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us