It sounds like you want to declare a new generic parameter for the method, in which case you could use:
<U extends Number> boolean isAverageSame(Stats<U> ob)
Note that this will allow you to do something like:
Stats<Integer> x = ...;
Stats<Float> y = ...;
boolean z = x.isAverageSame(y);
Is that what you want? If you only want to be able to compare a Stats<Integer>
with a Stats<Integer>
(etc) then you just need:
boolean isAverageSame(Stats<T> ob)
... in other words, the method won't introduce another generic type parameter.