public class GenericClassDemo { private A a; public void set(A a) { this.a = a; } public A get() { return a; } public static void main(String[] args) { GenericClassDemo integerObj = new GenericClassDemo(); GenericClassDemo stringObj = new GenericClassDemo(); integerObj.set(new Integer(30)); stringObj.set(new String("Roseindia")); System.out.printf("Integer Type Object's Value :%d\n\n", integerObj .get()); System.out.printf("String Type Object's Value :%s\n", stringObj.get()); } }