Java cast parent to child?
<p>Here is my code:</p>

<pre><code>for (DrawableEntity entity : drawableEntityList) {
    if (entity instanceof Beam) {
        (Beam) entity.age += timeElapsed;
    }
    else if (entity instanceof Block) {

    }
}
</code></pre>

<p>Basically drawableEntityList is a Vector of DrawableEntitys, and I want to iterate through everything in the Vector then depending on if they are subclass Beam or subclass Block do something different.</p>

<p>The problem is that I'm trying to change a variable that only the subclasses have, I figured I could cast with (Beam) but it doesn't work.</p>

<p>Is it not possible to cast a parent class to a child class?</p>
