i have a situation where i need the Checker enum below used in multiple classes:
package Sartre.Connect4;
public enum Checker {
EMPTY,
RED,
YELLOW
}
so i put the Checker in a Checker.java file and then from the classes that need it i simply do the following:
example:
public Cell(){
currentCell = Checker.EMPTY;
}
example:
public Cell(Checker checker){
currentCell = checker;
}
and the code compiles fine and runs fine also.
so what is my question? well being new to Java i am just wondering if the way i use Checker without encapsulating it in a class is a sound implementation?
it may be because of The enum declaration defines a class (called an enum type). as noted in Java docs enum tutorial page.
thank you for your insight into this matter.