Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Eclipse problem with enum

I'm using Eclipse Version: 3.2 and JDK version 1.5.0. The following compiles:

package testing;

import java.util.*;

public class Token {
public enum Days
{
SUNDAY(1),
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY;
private Days() {}
private Days(int i) {}
}
}

But with Eclipse, it says "enum does not resolve to a type". I don't think I'm alone: http://www.codecomments.com/archive251-2005-4-469867.html

But I couldn't get it working...
[581 byte] By [norman_fung] at [2007-11-11 7:38:56]
# 1 Re: Eclipse problem with enum
You need to:

Window>Preferences>Java>Compiler>JDK Compliance> set to 5.0

http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.jdt.doc.user/gettingStarted/qs-with-j2se50.htm
norman_fung at 2007-11-11 22:37:42 >