Suppose I have the following code snippet
Number n=new Integer(2);
then when I use the code ,its shows an error
Class<Number> hi=n.getClass(); //type mismatch error
but if below code works fine
Class<? extends Number> hi=n.getClass();
Why is it so ? Please explain in some simple & precise words.