File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Programming restrictictions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Programming restrictictions" Watch "Programming restrictictions" New topic
Author

Programming restrictictions

Peter Warde
Ranch Hand

Joined: Aug 18, 2004
Posts: 71
I know you can't use a static variable, but can you use a static final variable ie a constant? What about static methods in beans?
Severin Stoeckli
Ranch Hand

Joined: Jul 21, 2004
Posts: 62
If you use static methods in a helper class there's no problem. If you use static methods in your bean class directly there could be a problem, depending on your container implementation. The countainer is allowed to subclass your bean and could miss to take in count that you could made a static class.

Remark: don't use static members in helper classes!!! (they have tha same effect as in your bean class).
Roger Yates
Ranch Hand

Joined: Aug 31, 2004
Posts: 118
Using static *final* variables is ok (as long as it is not a final reference to a modifiable class instance!).
e.g. this would be ok:
static final int ONE = 1;
but this would not:
static final StringBuffer msg = new StringBuffer();

since you could still modify the data in the StringBuffer.


Cheers,<br />Roger<br />SCJP 1.2, 1.4, SCBCD 1.3, SCWCD 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Programming restrictictions