title: Is it possible to override a superclass' method with a parameter extending the superclass' method parameter?
body: <p>Say I have a class like so:</p>
  
  <pre><code>abstract class Something {}
  </code></pre>
  
  <p>And it has a hierachy with classes extending it:</p>
  
  <pre><code>class FirstSomething extends Something {}
  class SecondSomething extends Something {}
  </code></pre>
  
  <p>Then elsewhere I have a class making use of these somethings:</p>
  
  <pre><code>abstract class A {
      public void setSomething(Something something) {
          //Process the something
      }
  }
  </code></pre>
  
  <p>Am I able to specify a subclass of A, so that it overrides the setSomething method, with the more specific "something" classes?
  This is what I want to be able to do:</p>
  
  <pre><code>class B extends A {
      @Override
      public void setSomething(FirstSomething something) {
          //Process the something
      }
  
  class C extends A {
      @Override
      public void setSomething(SecondSomething something) {
          //Set the something
      }
  </code></pre>
  
  <p>At the moment I am doing something like this in the A class:</p>
  
  <pre><code>public void setSomething(Something something) {
      checkClass(something);
      //Use the something
  }
  protected abstract void checkClass(Something something);
  </code></pre>
  
  <p>where the B class and C class throw an exception in the checkClass method if the type of the SuperSomething is not the right one for those classes.</p>
  
  <p>EDIT:
  I have tried with the exact method signatures as above, but the subclass methods do not override the super's method, I suppose I am really asking:
  Is there a way to specify a method in the super class' definition, where there is a compile-time check for the types of object allowable in the setSomething method for subclasses of the superclass?</p>