Well, the difference is that if you try to make each method of its kind a universal type of the general type that you use in your firstGenericMethod, it may or may not be the same type. What I mean.
public <T> void firstGenMethod(...){
}
public <T> void secondGenMethod(...){
}
Test:
SomeClass ref = new SomeClass();
ref.firstGenMethod("string");
ref.secondGenMethod(123);//legal as this generic type is not related to the generic type which is used by firstGenMethod
In the above case there is no gaurentee that both methods have the same common type. It depends on how you call them. However, if you create a generic class, this type applies to all methods inside this class.
class Test<T>{
public void firstGenMethod(T t){
}
public void secondGenMethod(T t){
}
}
Test:
Test<String> testingString = new Test<>();
testingString.firstGenMethod("abc");
testingString.firstGenMethod(123);// invalid as your Test class only expects String in this case
, , () . - Java Collection Framework