When will I use a Class Variable in Java v.s an Instance Variable?
===

Here is a generic class that I have defined, what I would like to know is when I am creating more specific classes for instance a CAR class when would I use a Class Variable? My personal understanding of a class variable is that a single copy of a class variable that has been declared in a class will be declared using the keyword static, and that each object that has been instantiated from the class will contain a single copy of the class variable.

An instance variable allows each instance of a class / object that has been created from the class to have a separate copy of the instance variable per object?

So an instance variable is useful for defining the properties of a class / data-type e.g a House would have a location, but now when would I use a class variable in a House object? or in other words what is the correct use of a class object in designing a class?

    public class InstanceVaribale {
	public int id; //Instance Variable: each object of this class will have a seperate copy of this variable that will exist during the life cycle of the object.
	static int count = 0; //Class Variable: each object of this class will contain a single copy of this variable which has the same value unless mutated during the lifecycle of the objects.
	
	InstanceVaribale() {
		count++;
	
	}
	public static void main(String[] args) {
		
		InstanceVaribale A = new InstanceVaribale();
		System.out.println(A.count);
		InstanceVaribale B = new InstanceVaribale();
		System.out.println(B.count);
		System.out.println(A.id);
		System.out.println(A.count);
		System.out.println(B.id);
		System.out.println(B.count);	
		InstanceVaribale C = new InstanceVaribale();
		System.out.println(C.count);
	}
    }
