Class variables are tied to the class itself, and its value is shared across all class objects.
///within a class
modifier static variableName;
///accessing the class variable
className.variableName;The static modifier prefix is what makes a variable a class variable.
Class variables can be accessed using the object, but this is discouraged.
public class Car {
public static int numberOfWheels = 4; ///all cars have 4 wheels
}
Console.WriteLine("Number of wheels: " + Car.numberOfWheels);