title: Java Inheritance Question - How to change the properties of every sub class that is required in super
body: <p>I am new to java inheritance and I have been trying to create a game. </p>
  
  <p>This game has a game object abstract class and I created a <code>Enemy</code> class that extends it. Now I want <strong>to add multiple types of enemies to extend</strong> <code>Enemy</code>. I am trying to find <strong>the most efficient way to do this</strong> however I can not figure out how to give the sub class <code>final</code> properties that can be used by the <code>super</code> if that makes sense. <em>For instance</em>, I want all the enemies to have a speed in the X direction and the Y direction, but I want each type of enemy to have their own. </p>
  
  <p>The way I have it now, is basically pointless because even if I create an <code>FastEnemy</code>, I have to put it all in the constructor when I create the object. This is probably really simple, I am just new and never ran into this before.</p>
  
  <pre class="lang-java prettyprint-override"><code>package first.Game;
  
  import java.awt.Color;
  import java.awt.Graphics;
  import java.awt.Rectangle;
  
  
  public class Enemy extends GameObject{
  
      private Handler handler;
      private Color c; 
      private int eWidth, eHeight, speedX, speedY, x, y;
  
      public Enemy(int x, int y, int eWidth, int eHeight, int speedX, int speedY, Color c, ID id, Handler handler)
      {
          super(x, y, id);
  
          this.x = x;
          this.y = y;
          this.id = ID.Enemy;
          this.c = c;
          this.eWidth = eWidth;
          this.eHeight = eHeight;
          this.handler = handler;
          this.speedX = speedX;
          this.speedY = speedY;
      }
  
      public Rectangle getBounds()
      {
          return new Rectangle(x, y, eWidth, eHeight);
      }
  
      public void tick()
      {
          x += speedX;
          y += speedY;
  
          if(y &lt;= 0 || y &gt;= Game.HEIGHT - 48) speedY *= -1; //What can I do instead of 48?
          if(x &lt;= 0 || x &gt;= Game.WIDTH - 32) speedX *= -1;
  
          handler.addObject(new Trail(x, y, ID.Trail, c, eWidth, eHeight, 0.03f, handler));
      }
  
      public void render(Graphics g)
      {
          g.setColor(c);
          g.fillRect(x, y, eWidth, eHeight);
      }
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>package first.Game;
  
  import java.awt.Color;
  
  public class FastEnemy extends Enemy{
  
  
      public FastEnemy(int x, int y, int eWidth, int eHeight, int speedX, int speedY, Color c, ID id, Handler handler)
      {
  
          super(x, y, eWidth, eHeight, speedX, speedY, c, id, handler);
      }
  }
  </code></pre>