It is a common pattern I see where the error codes associated with an exception are stored as Static final ints. when the exception is created to be thrown, it is ...
Jacquie, Welcome to the Ranch. I started reading your explanation about the new Java 5 enum feature. I used this recently in a small project I am working on and it seems like a slick way to easily enumerate values, just like you described in your other posts. However, I am curious why your list of "previous solutions" does not include ...
Basically, because Sun is extremely reluctant to risk breaking backward compatibility, even for poor designs. Some parts of Java were written rather quickly, and early in the language's history - perhaps before the pitfalls of certain designs were well-understood. ObjectStreamConstants is an example of this. But it's possible that some programmers have extended ObjectInputStream or ObjectOutputStream in their own code and ...
In any case, that item should be updated now to advise you to use the Enum types introduced in 1.5 instead of rolling yer own. You are right, I'll use that instead - looks like I have an old edition of book! Anyway. just for me to understand what you mentioned, since the client code sees the value of RANDOM -- ...
I'm trying to use Joshua Bloch's typesafe enum pattern for an inner class but I am getting compiler warnings about not being able to declare static variables for an inner class (fair enough). Any ideas how I can adapt this pattern to use as an inner class? I'm not using Java5 by the way! Thanks