Static class fields are shared among all instances of a particular class, but only within a single Java Virtual Machine. Updating a static class field implies an intent to share the field's value among all instances of the class. But if a class is running in several JVMs simultaneously, only those instances running in the same JVM as the updating instance will have access to the new value. In other words, a nonfinal static class field will behave differently if running in a single JVM, than it will running in multiple JVMs. Maybe you can't call it a disadvantage, but is certainly something to remember when you are programming in a distributed environment. Read the J2EE blue print if you're interested in these kind of situations. It is available over here : http://java.sun.com/blueprints/guidelines/designing_enterprise_applications/ejb_tier/qanda/restrictions.html [ March 05, 2004: Message edited by: Arnold Reuser ]
Joined: Nov 20, 2003
Refactoring : 1. methods that do not use the unique data of a class instance and 2. variables that are not unique to an instance By making these methods and variables static is worth the effort. There are a lot of papers written about java performance, just google it.