What is a static variable?

A static variable, also referred to as a class variable, is a variable which exists across instances of a class.

The opposite of a static variable is an instance variable, which is a variable related to a single instance of a class. Each time an instance of a class is created, the system creates one copy of the instance variables related to that class.

By default, all variables are created as instance variables. To make a class variable, you must explicitly declare the variable static.




Bookmark What is a Static Variable?

Latest Blog Posts


Copyright 2008 Tech-FAQ. All rights reserved.