title: Java interface method - parameter and return value type as child of Number
body: <p>I am not very skilled in Java so I consider my question as basic. I am writing an interface for something like ArrayResult. There will be methods add and get.</p>
  
  <p>Problem is that ArrayResult can obtain values of Integer or Double. So I need to define methods in interface more generally. I figured out that it is possible to have something like this for get method:</p>
  
  <pre><code>public &lt;N extends Number&gt; N get(Integer index);
  </code></pre>
  
  <p>Is that correct? I believe this means that get method can return anything what extends Number Object. What sytax to use for add method?</p>
  
  <pre><code>public void add(Number value);
  </code></pre>
  
  <p>This is not what I want since add(Integer value) doesnt override the interface method.</p>