Example:
interface Gen
{
T com(T obj1,T obj2);
};
class demo
{
public T com(T obj1,T obj2){
if(obj1>obj2)return obj1;
return obj2;}
public static void main(String[] args){
Gen
System.out.println("greater between 10 and 20 is:="+obj.com(new Integer(10),new Integer(20)));
}};
No comments:
Post a Comment