This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The object is to have this embedded class of flags and their descriptions to be common and immutable for all instantiantions of the user class.
I get an error that says:
/home/anw/SoftwareProducts/WebWork/infoisland/src/infoIsland/user.java:40: non-static variable this cannot be referenced from a static context new UserFlag(0x00000001, "smsntfy", "Notify me of private messages with an SMS message"), ^
when I try to do this.
I think it doesn't like the "new" keyword. Having said that, I've tried several combinations and permutations of syntax to try to achieve this (no "new" keyword, no "UserFlags" (so it's like an array initialization), etc.).
The goal is to have the same stuff for each user, and, for reasons of efficiency, I'd like to not to have separate instances of this for each user. What is the Java way to do this?