This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Some languages call static variables "class" variables. I like that name because they store some information about the class in general. Non-static variables store information about one particular object or instance of the class. I had a class that for debugging needed to identify each new instance by something unique. So here's a mix of static and non static:
There is one instanceCounter variable for the class, no matter how many objects I make. And one idNumber per object so each instance gets its own id number. The numbers helped me keep messages in the console straight. Another good use for static is to make it easier to share methods and information. If we put critical information in a particular instance of a class, we have to be able to get ahold of that instance to get the information. But if the methods or information are static, we only need to reference the classname.
This time a static variable and a static method made Logger easier to use. Classes with all static stuff are called "utility" classes. Some folks will argue that they are not "good" OO but they work and are commonly accepted. Was that clearer or more confusing? Ask again if it's not making sense.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi