File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Static variables? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Static variables?" Watch "Static variables?" New topic
Author

Static variables?

Ganesan Ramakrishnan
Ranch Hand

Joined: Mar 18, 2008
Posts: 89
What is the use of static variables?
Ra Sank
Greenhorn

Joined: Jun 02, 2008
Posts: 14
Static Variables are common to all the instances of a particular class where they declared and defined.


Learning Java.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

To put it more correctly, static variables are class members, not instance members.

edit: and exist independently of any instance of the class being constructed or not.
[ June 16, 2008: Message edited by: Darryl Burke ]

luck, db
There are no new questions, but there may be new answers.
camilo lopes
Ranch Hand

Joined: Aug 08, 2007
Posts: 202
variable static you shared the value for all class and for one object scpecific. for example:
you are value dollar:


then this value �s shared for all class, not necessary create one instance for get the value this variable.


Brazil - Sun Certified Java Programmer - SCJP 5
http://www.camilolopes.com/ About Java - Update every Week.
Guide SCJP - tips that you need know http://blog.camilolopes.com.br/livrosrevistaspalestras/
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Originally posted by camilo lopes:


Off-topic, but important: -

Never use "double" or "float" for money calculations. Use integer arithmetic (in cents, pence etc.) or BigDecimal. If you don't know why, read up on floating-point arithmetic and why it is unsuitable for currency calculations.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Ganesan Ramakrishnan
Ranch Hand

Joined: Mar 18, 2008
Posts: 89
Thanks for all ('=').
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Static variables?