Re: Using an enum in a constructor
On Sep 20, 4:38 pm, Wojtek <nowh...@a.com> wrote:
Roedy Green wrote :
On Thu, 20 Sep 2007 20:33:13 GMT, Wojtek <nowh...@a.com> wrote, quoted
or indirectly quoted someone who said :
public class Foo
{
private static final int DEFAULT_LENGTH = 30;
private Type ivType;
private int ivLength;
public enum Type
{
OTHER,
FIXED,
VARIABLE;
}
You have this as a nested inner instance class. I have always made my
enums separate top level classes. Perhaps you are allowed to define
them as static inner classes. Perhaps there are magic exceptions made
for enums to the usual nesting rules. Is there a language lawyer
about?
We have had this discussion before, but I do not remember seeing your
example.
If I use the above, then I reference it with Foo.Type.FIXED.
What does your separate top level enum class look like, and how do you
reference it?
--
Wojtek :-)
/* MySeperateEnum.java */
public enum MySeperateEnum {
A,B,C;
}
/*SomeOtherClass.java*/
public class SomeOtherClass {
MySeperateEnum value = MySeperateEnum.A;
}