title: Java: Overriding an abstract method in subclass
body: <p>I really should know this, but for some reason I don't understand the following.</p>
  
  <p>My abstract class contains the following abstract method:</p>
  
  <pre><code>protected abstract RuleDTO createRowToBeCloned(RuleDTO ruleDTO);
  </code></pre>
  
  <p>I also have another class as follows:    </p>
  
  <pre><code>EvaluationRuleDTO extends from RuleDTO
  </code></pre>
  
  <p>Then in a subclass of my abstract class I have the following implementation which is not allowed due to "must override or implement a supertype method":</p>
  
  <pre><code>protected EvaluationRuleDTO createRowToBeCloned(EvaluationRuleDTO ruleDTO) {
  </code></pre>
  
  <p>However, the following is allowed:</p>
  
  <pre><code>protected EvaluationRuleDTO createRowToBeCloned(RuleDTO ruleDTO) {
  </code></pre>
  
  <p>I realize this is probably a basic question but I am a little bemused. How come I can I can return a subclass of RuleDTO in the overridden method, but I can't pass in a subclass?</p>
  
  <p>Thanks</p>