Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Static vs Non static

843798May 18 2007 — edited May 22 2007
Hi,


I was just not clear as to how does the compiler handle Static members.

As far as fields are concerned if they are declared static, they are created on the HEAP and are shared by all the class instances.

However, what i want to know is what happenes to the methods. I mean methods are just piece of code so why should a non-static method be instantiated for all the instances?

So, I presume that static members mean that they are created on the HEAP.

Am i right here?


Thanks

Praveen
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 19 2007
Added on May 18 2007
7 comments
717 views