Worked example
class Dog {
static int count; // one shared counter for all Dogs
Dog() {
count = count + 1; // every new Dog bumps the shared count
}
}
new Dog();
new Dog();
new Dog();
System.out.println(Dog.count); // 3
Notice you read it through the class name: Dog.count.