What is the difference between static and instance variables/methods?

Beginner

Answer

Static members belong to the class itself, not to any instance. They're loaded when the class is first loaded and shared among all instances.
Instance members belong to specific object instances and require object creation to access.

class Example {
    static int staticVar = 0;     // Class variable
    int instanceVar = 0;          // Instance variable
    static void staticMethod() {  // Can't access instance members
        // staticVar++; // OK
        // instanceVar++; // Compilation error
    }
    void instanceMethod() {       // Can access both
        staticVar++;
        instanceVar++;
    }
}