@shreenath,
Ummm, I don't think so. The keyword "static" refers to how the entity is allocated. Plus, the keyword is overloaded somewhat, as a "static" class is not statically allocated, rather it is one which does not require an outer class object to be allocated.
The keyword "final" is the closest to the "constant" concept that Java has. A "final" attribute is one which is assigned at class load ("static" attributes) or object creation (others), and cannot be overridden. In that sense, the "final" attributes are constant. However the object referred to by a "final" attribute is not constant by any means. It is quite common for programmers to write code like this:
- private final StringBuffer inBuffer = new StringBuffer();
Which means that
inBuffer is assigned to a StringBuffer object that cannot be replaced. However, the class can perform any actions it wants against the StringBuffer.
Perhaps
this article will help clarify things.
Of course, there is
this proposal for adding "const"ness to java. However I think its flawed, in that "const" in the proposal applies to objects, but is declared for variables/attributes.