I think I'm making a concept harder than it really is again. No program written yet, just going through some concepts.
public class Clock
private int hr; // store the hours
private int min; // store the minutes
private int sec; // store the seconds
"The non-static data members of a class are called instance variables. Therefore, the variables hr, min, and sec are the instance variables of the class Clock."
Definition from :Variables (The Java™ Tutorials > Learning the Java Language > Language Basics)
Non-static fields are also known as instance variables because their values are unique to each instance of a class (to each object, in other words)...
I don't get it.The definition "unique to each instance of a class"?
What happened when you threw together a simple example to play with?
Say you have some class called ExampleObject. ExampleObject has a non-static field in it called someVariable.
You can then have:
So each instance of ExampleObject has someVariable, but the value of that variable depends on which instance you're talking about.
ExampleObject obj1 = new ExampleObject();
ExampleObject obj2 = new ExampleObject();
obj1.someVariable = 1;
obj2.someVariable = 2;
That's not true with static variables. If you change the static variable of a class, you change it for every instance of that class.
I really recommend you throw together a basic example and test it out yourself.