Re: enums
- From: Jan Thomä <kork@xxxxxxxxxxxxxx>
- Date: Sun, 05 Jun 2005 23:44:35 +0200
Is that "Input" an inner class by coincidence ? This would explain the error
msg, because you cannot do any static declaration in an inner class...
Best regards,
Jan
guyvo wrote:
> hi,
>
> I was glad to hear that v1.5 the enum class was introduced. I have a piece
> of code
>
> public class Input{
> public enum Condition {open,close}
> private Condition State;
>
> Input (Condition state){State = state;};
>
> protected void SetState (Condition state){State = state;};
> protected Condition GetState(){return State;};
>
>
> }
>
> The compiler gives me the following error :
>
> "enum declarations allowed only in static contexts"
>
> The enum in this example is just used as a type to my variable.
> What is wrong here?
> What purpose does it have than in respect to other langauges like C ?
--
______________________________________
insOMnia - We never sleep....
http://www.insomnia-hq.de
.
- Prev by Date: Re: what is assertion in java?
- Next by Date: Re: file I/O question
- Previous by thread: Re: what is assertion in java?
- Next by thread: Re: file I/O question
- Index(es):
Relevant Pages
|