Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

static variable with assembly code ?  RSS feed

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?

Thanks.
 
Henry Wong
author
Sheriff
Posts: 22840
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Henry
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!