• Post Reply Bookmark Topic Watch Topic
  • New Topic

read/write static field = static field ?

 
Himai Minh
Ranch Hand
Posts: 1400
8
  • 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: 3012
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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!