Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static variable with assembly code ?

 
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
Marshal
Pie
Posts: 21405
84
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic