Java - Overriding Object Type Parameter With Concrete Type
<p><strong>EDIT:</strong> I will leave this here as an example. Read the comments for more information but generally: DON'T USE THIS DESIGN! It's BAD!</p>

<p>I searched for an answer for a while now, but couldn't find anything really specific saying, no you can't because... or yes you can that's how you do it..</p>

<p>So the question is, Can I create an abstract method defining Object type parameters and then have something implement it with a concrete Type of parameter like this:</p>

<pre><code>public abstract class ToBeOverriden {
    public Object method1 (Object parameter);
    public String method2 (Object parameter);
    public void method3 (Object parameter);
}
</code></pre>

<p>And then override it with this:</p>

<pre><code>public class Implementation {
    @Override
    public DateTime method1 (Person parameter){
        return new DateTime();
    }

    @Override
    public String method2 (MotorCycle parameter){
        return new DateTime();
    }

    @Override
    public void method3 (String parameter){
        return new DateTime();
    }
}
</code></pre>

<p>Where Person is an object created by me. Return Type can be whatever. Currently I can't do this. It doesn't let me. My guess is that this is because my Class doesn't extend Object. Although everything extends Object... So... </p>

<p>Or do I need to refresh my Java knowledge? :)</p>

<p>EDIT: Added a more complex class structure.</p>

<p>Thanks!</p>
