Deleting an object in java?
<p>I want to delete an object I created, (a oval which follows you), but how would I do this? </p>

<pre><code>delete follower1;
</code></pre>

<p>didn't work.</p>

<p>EDIT:</p>

<p>Okay, I'll give some more context. I'm making a small game with a oval you can control, and a oval which follows you. Now I've got files named: DrawPanel.class, this class draws everything on the screen, and handles collisions, sounds, etc. I got an enemy.class, which is the oval following the player. I got an entity.class, which is the player you can control. And if the player intersects with the follower, I want my player object to get deleted. The way I'm doing it:</p>

<pre><code>    public void checkCollisions(){
    if(player.getBounds().intersects(follower1.getBounds())){
        Follower1Alive = false;
        player.health = player.health - 10;
    }
}
</code></pre>
