I am trying to define an enum within a class but Eclipse continues to underline my code in the lovely red color. Here is what my code looks like for the most part:
package campusvilleFoodBank;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class FoodArrayList {
public enum Days {SUN, MON, TUE, WED, THUR, FRI, SAT}
private Food [] foodArray;
private int iterator;
private boolean startIndexing;
private static final int MAX = 24;
public FoodArrayList(){
foodArray = new Food [MAX];
iterator = 0;
}
public FoodArrayList(int arraySize){
foodArray = new Food [arraySize];
iterator = 0;
}
//Rest of code, with more complicated methods here
}
I must be missing something very simple, it's likely to be a syntax error.... The code that follows involves methods such as my toString()
, some sorting methods for the foodArray
instance variable, and things along those lines. I do not have a main method defined. I know that I can define an enum within a class definition and all of the code I've seen elsewhere is written nearly exactly the same as to what I have. However, Eclipse does not seem to recognize even the enum
declaration and I don't believe I need to import anything.
Here is what I see in Eclipse for the code I have an error with:
For comparison, here is some enum code from another, separate .java file that appears to be without error:
Any assistance on this would be appreciated. Let me know if further clarification is needed.