To answer the basic question, you need to declare a backing field called state
for the get and set.
public class StateMachine {
// This is the missing part
private static State state;
public static State getState() {
return state;
}
public static void setState(State newState) {
state = newState;
}
}