This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
we are always told, static variable will be assigned a specific memory space so that it will not be attached to instance of that class. Then how could I verify this ? To get assembly code for that class is a good way or we have other ways ?
Edward Chen wrote:Then how could I verify this ? To get assembly code for that class is a good way or we have other ways ?
How about simply instantiating two objects of the same class that has a static variable? And set / get the static variable from those two instances? You can see that changing using one instances affect the other -- not separate variables.