I need a non-generic class containing a method with two generic parameters . In this method my goal is to compare two generic parameters and return the greater value. How can I do it?
public class generic <T extends Comparable<T>>{
public T Max( T pv, T sv){
if(pv.compareTo(sv)>=0){
return pv;
}else {
return sv;
}
}
public static void main(String[]args){
generic g = new generic();
System.out.println(g.Max( 2, 7));
}
}