myGrid
variable is an instance variable rather than a class variable. That is, it can only be accessed by an instance of Zombies
. On the other hand, the static methods (and class, a.k.a. static, variables) belong to a class, which are shared, in this case, among all Zombies
instances.
Either pass myGrid
(int[][]
) as parameter to each of these static methods, or declare it as static
.