Думаю это потому что процесс повторяется бесконечно
private void createNewApple(){
int res1 = getRandomNumber(WIDTH);
int res2 = getRandomNumber(HEIGHT);
apple = new Apple(res1,res2);
do{
apple=new Apple(res1,res2);
this.apple=apple;
}while(snake.checkCollision(apple)==true);
}
package com.javarush.games.snake;
import com.javarush.engine.cell.*;
public class Apple extends GameObject {
private static final String APPLE_SIGN="\\uD83C\\uDF4E";
public boolean isAlive = true;
public Apple(int x, int y) {
super(x, y);
}
public void draw(Game game) {
game.setCellValueEx(x,y,Color.NONE,APPLE_SIGN,Color.RED,75);
}
}