aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Static reference varaible. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Static reference varaible." Watch "Static reference varaible." New topic
Author

Static reference varaible.

Narasimha Rao B.
Ranch Hand

Joined: Aug 26, 2002
Posts: 205
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.


Narasimha
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
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 ]

SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Static reference varaible.
 
Similar Threads
initialisations and constructor
Casting
Static Initializers
Static in Java
simple prog.