How to implement a class when one of its properties is an enum variable?

PHOTO EMBED

Wed Apr 01 2020 07:05:44 GMT+0000 (UTC)

Saved by @Toxinta #java #java #enumvariable #class

enum State {
  Visited,
  Unvisited,
  Visiting    
}
class Node {
    State state;
    public Node() {
        // say something about the state
    }
}
content_copyCOPY

Define the enum outside the class and then make instance of that enum inside the class as above.The Enum in Java is a data type which contains a fixed set of constants.

https://stackoverflow.com/questions/60963806/how-can-i-implement-a-class-when-one-of-its-properties-is-an-enum-variable