wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes static variable with assembly code ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static variable with assembly code ?" Watch "static variable with assembly code ?" New topic
Author

static variable with assembly code ?

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
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

Joined: Sep 28, 2004
Posts: 18508
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: static variable with assembly code ?
 
Similar Threads
Is there a debug flag in java?
regaring threads
Doubt in static...
Problem with protected variable...
difference between public static and private static with instance variables???