Re: Problem with Eclipse and Enum's
- From: Steven <steven.green30@xxxxxxxxxxx>
- Date: Fri, 22 Apr 2005 13:43:00 GMT
On 21 Apr 2005 18:15:28 -0700, MrFredBloggs@xxxxxxxxxxx wrote:
>I tried the following and it worked.
>
>public enum Days
>{
> SUNDAY(1),
> MONDAY,
> TUESDAY,
> WEDNESDAY,
> THURSDAY,
> FRIDAY,
> SATURDAY;
> private Days() {}
> private Days(int i) {}
>}
>
>It uses private constructors though, according to Eclipse, public ones
>aren't allowed (is that correct, must they always be private?).
>
>Fankx for the help,
>
>Fred.
To start off, Eclipse didn't seem to care that the constructors were
public or private, not sure if that matters or not.
I don't know the answer to my following question, but I am taking a
guess based upon the example implementation.
Enums in Java seem as though they don't have a particular value. For
example Days.SUNDAY doesn't equal 1. I may be wrong and hope if
someone else has a better information they will post it. They appear
to be more complicated than the C++ cousines.
I am not sure if this implementation with empty constructor calls is
really what you have in mind.
Just thinking out loud.
--Steve
.
- References:
- Problem with Eclipse and Enum's
- From: MrFredBloggs
- Re: Problem with Eclipse and Enum's
- From: Steven
- Re: Problem with Eclipse and Enum's
- From: MrFredBloggs
- Problem with Eclipse and Enum's
- Prev by Date: Re: conditional to connect to db
- Next by Date: Re: Desktop applications in java?
- Previous by thread: Re: Problem with Eclipse and Enum's
- Next by thread: Writing to file(s) using dynamic filenames
- Index(es):
Relevant Pages
|