Hi, If we declare a varaible as static, it means it is a class variable as every one knows. If we declare a reference variable as static, what it means?..... Thanks in Advance, Narasimha.
posted 13 years ago
Could you explain how a variable is different from a reference variable? Actually, there are two kinds of variables, reference variables that reference objects on the heap, and primitive variable that hold primitive values (1, 4.56f, false, ...). When using the term "variable", we mean both reference and primitive variables. Both of them may be declared static, that is, they pertain to the class and not to an instance of that class. An example of a static primitive variable could be a instance counter that increments each time an instance of the class is created.
An example of a static reference variable could be a singleton instance of a class.
[ March 26, 2003: Message edited by: Valentin Crettaz ]