WELCOME TO JAVA FAQS
Example of Generic class having two type parameters:
class Gen
{
T1 obj1;
T2 obj2;
Gen(T1 a1,T2 a2){this.obj1=a1;this.obj2=a2;}
T1 getobj1(){return obj1;}
T2 getobj2(){return obj2;}
};
class demo
{
public static void main(String[] args){
Gen
i=new Gen
(10,"bhabani");
System.out.println(i.getobj1()+i.getobj2());
}};
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment