static | non-static : -associated with class -associated with instance or object -exactly one per program -exactly one per instance or object The main difference between static and non static is anything that is static is associated or belongs to a CLASS. Anything that is non-static is associated or belongs to an OBJECT. Both methods and non-local variables (any variables not defined within a method) always belong to either a class or an Object. Remember the difference between Object and class. A class is a definition of what an Object will look like when it is created. The . operator is used to denote "belongs to" in Java. Since attributes/non-local variables and methods always belong to either a class or an Object, this means I can always access them by writing: something.nameofattributeormethod where something is whatever the attribute or method belongs to. In the case of STATIC attributes or methods, the something is always a class. In the case of non static attributes or methods, the something is always an object. This means to use a static attribute or method, you will write NameOfClass.nameOfVariable To access a non-static attribute or method, you will write: NameOfObject.nameOfVariable This will work 100% of the time. In addition to this, there are a couple complications that can happen if you decide to omit the . If you omit the dot, Java tries to make a guess as to what you could mean. Every attribute or method belongs to a class or Object, but Java will try to guess "who" the owner is using the following rules: 1)If you are in a static method, it will guess the owner is the class that the code is in. This means if you are in a static method that is inside the Math class, you could just write PI, and Java would guess that you actually meant Math.PI 2)If you are in a non-static method, Java will first guess that the owner is "this" which is the Object on which the current method was called on (since any non-static method has to belong to an Object as owner). If "this" does not have a non-static attribute or non-static method by that name, then it will guess that the owner is the name of the class the code is in and that it is actually a static method you want to call. If that isn't found either, you'll get a compiler error. The code below is copied from lecture notes. public class MyMath { public static double PI = 3.14159; public String name; public MyMath(String name) { this.name = name; } public static void someMethod() { double PI = 1.0; System.out.println(PI); // print 1.0 System.out.println(MyMath.PI); //prints 3.14 foo(); MyMath.notStaticMethod(); // ---> gives error notStaticMethod(); // ---> give error MyMath mathObject = new MyMath("Euler"); mathObject.nonStaticMethod(); this.nonStaticMethod(); // error since this is undefined } public void changePi() { PI = 1; } public void changeName(String newName) { name = newName; } public void grounded() { System.out.println(name + " " + PI); this.notStaticMethod(); // OK notStaticMethod(); // OK ---> same as this.notStaticMethod(); MyMath.someMethod(); // OK someMethod(); // OK MyMath someOtherMath = new MyMath("Einstein"); someOtherMath.grounded(); // OK someOtherMath.someMethod(); // ERROR } public void notStaticMethod() { System.out.println("I'm not static"); } public static void foo() { MyMath m1 = new MyMath("joe"); m1.grounded(); // prints Joe 314159 m1.changePi(); MyMath m2 = new MyMath("bob"); m2.grounded(); // print bob 1 m1.changeName("john"); m2.grounded(); // print bob 2 } } MyMath m1 = new MyMath(); MyMath m2 = new MyMath(); ---exactly one PI System.out.println(MyMath.PI); // print 3.1.4159 System.out.println(m1.PI); // compiler error -static method from non-static -static method from static -non static method from static on new object -nonstatic method from static -non static method from non-static