I created the enumeration class and initialization class, but when I went to implement these changes I tried adding objects of type enumType to an array list of objects.
public enum inputType {
POLNBR, NAME, CLMNBR, PHN;
}
public class enumType {
inputType type;
public enumType(inputType type){
this.type = type;
}
}
What I don't understand is why I can only get it to work in a static way. Meaning I was only able to add to the array list by using the enumeration class attribute instead of instantiating an object of said class.
private List<inputType> possibilities = new ArrayList<inputType>();
Then later I add to the array with:
possibilities.add(inputType.POLNBR);
I was able to add an object, but I was not able to return the object attribute, so this is the only way I was able to make it work.
Is this the correct way to use enum classes??
Is there a way to add the object and later return the object with the attributed enum value?
Sorry, I have never tried to use them, and I am trying to add them to my repertoire.