All statements must be in a method body.
Statements can also exist in a static initializer block. However, for that to work in the OP's case, player1
would have to be static, too. The following compiles.
public class StaticTest
static Player player1 = new Player();
public static ArrayList<Entity> entities = new ArrayList <Entity>();
class Player extends Entity
But most likely, yes, the right answer is probably to wrap the .add() in a method or constructor.