Intro to Java and Static Stuff

This entry is part 2 of 13 in the series Intro to Java

This lesson will cover some basic concepts in Java related to static variables and methods. It was created as a lesson for a class room setting. I have converted it to a post here.

What does static mean?

Lucky for us, static has nothing to do with statics, a class I had to take in Engineering about the forces on objects that are not moving.

What is does have to do with, seems to go against the concepts we talked about in the Classes vs. Objects lesson. If you followed along there, we talked about how the Class was the blueprint, and the Object was a concrete, instantiated, “built” Class. Its variables were its own, and the methods belonged to this Object.

When something is static, it means that it belongs to the class, and not the object. Every object has access to this item, but it is not unique to the object.

Sun Trails

Index: http://java.sun.com/docs/books/tutorial/index.html

Link into OO Trail: http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html
Continue reading