class Gen {
T ob; // declare an object of type T
Gen(T o) {
ob = o;
}
T getob() {
return ob;
}
void showType() {
System.out.println("Type of T is " + ob.getClass().getName());
}
}
public class GenDemo {
public static void main(String args[]) {
Gen iOb;
iOb = new Gen(88);
iOb.showType();
int v = iOb.getob();
System.out.println("value: " + v);
System.out.println();
Gen strOb = new Gen("Generics Test");
strOb.showType();
String str = strOb.getob();
System.out.println("value: " + str);
}
}