Friday, 13 September 2013

Is a static variable in java treated as a pointer internally?

Is a static variable in java treated as a pointer internally?

I have a question about the key word static. Lets say for instance we have
this piece of code.
public class Foo
{
private int age;
private static int weight;
..
...
}
Say in main you create 2 objects. You change the age in one and then you
change the weight in the other. Does that mean that the weight also
changes in the first object as well? If that is the case then does that
mean that weight is a pointer?
I guess my question in a nutshell would be. How does static work
internally? Is it essentially of a pointer type?

No comments:

Post a Comment