I'm building my first very basic game in JAVA without using any other external libraries.
The problem I got is 
[![You can see that the background is rendered over player how can I fix that](https://i.stack.imgur.com/rAhqi.png)](https://i.stack.imgur.com/rAhqi.png)

You can see that the background is rendered over player how can I fix that
The player rendering code is as follows

```
@Override
    public void render(Graphics g) {
        int bulletcount = 0;
        //render player
        g.setColor(color);
        g.fillRect(x,y,32,32);
        if(shooting) {
            handler.add(new bullet(x + 8, y - 24, ID.bullet, handler));
            bulletcount++;
        }
    }

```

and the background render code is as follows.

```
public class background extends GameObject{
    private int width;
    private Random random = new Random();
    public background(int x, int y , ID id,Handler handler){
        super(x,y,id,handler);
        valy = 2;
        width = getWidth(x,800);
    }
    public void tick() {
        y += valy;
        if(y>650)
            handler.remove(this);
    }
    public void render(Graphics g) {
        g.setColor(Color.white);
        g.fillRoundRect(x,y,width,10,1,1);
    }

    public int getWidth(int x,int width1){
        int wid;
        while(true){
            if((width - x) > 35) {
                wid = random.nextInt((width-x-35));
                break;
            }
            else{
             x -= 10;
            }
        }
        return wid;
    }
}

```

the main class of game can see the order of flow of execution.

```
 private void render() {
    // render the Game
        BufferStrategy bs = this.getBufferStrategy();
        if(bs == null)
        {
            this.createBufferStrategy(3);
            return;
        }

        Graphics g = bs.getDrawGraphics();
        g.setColor(Color.black);
        g.fillRect(0,0,WIDTH,HEIGHT);
        handler.render(g);
        hod.render(g);    //handler is rendering every object in game
        g.dispose();
        bs.show();
    }

    private void tick() {
    //update Game
        handler.tick();
        hod.tick();
        spawner.tick(); // background is generating in spawner class.
    }

```

I know that telling the problem with this much less code is hard for you all. But I have complete faith in this large and powerful community.

Thanks in advance. Don't hesitate to edit and point out my mistakes Thanks!