An object on the playing field can have one of two states: it can be alive (isAlive=true) or dead (isAlive=false). For example, if the snake hits the edge of the playing field, it dies. The same thing happens to an apple when it is eaten by the snake. To store object state, create a boolean isAlive
Snake (Part 7/20)
You must be signed in to leave a comment
Ian De Bie Full Stack Developer
21 July 2020, 03:51
they make you put the enum in a separate file or you won't pass this lesson
19 February 2021, 15:30
It says that it should be a public enum. Class files can only have one public class/enum/interface per file, not one of each but only one. Java code will not compile if you have more than one public in the same file, which means that you would couldn't put a public interface in the file that already had a public Snake class.
17 January 2020, 15:44
I have created private Direction direction and setter for it but still last two requirements are not getting fulfilled. Please help.
10 March 2020, 15:48
I had the above problem until I realized the file with the enum needs to be empty save for the enum declaration - when it was inside the class, it wouldn't work.