• Post Reply Bookmark Topic Watch Topic
  • New Topic

read/write static field = static field ?  RSS feed

 
Himai Minh
Ranch Hand
Posts: 1516
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Read/write static field is not allowed in EJB. But final static field is allowed, according to chapter 21 Runtime Environment of JSR-318.

I google "read/write static field". But I cannot find a definition of this term.

Does "read/write static field" means static field ?
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it means a non-final static field, also called a class variable. Those are not allowed allowed in EJBs, but static finals are allowed. The intent is to enable defining constants in the EJB code, like a static final String or int. I admit though, you could put a static final mutable object in your EJB and store stuff in there just like you would with non-final static fields. However, that would go against the spirit of the specification.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!