public class Container<T> { private T obj; public Container(T obj) { this.obj = obj; } public T getObj() { return this.obj; } public void showType() { System.out.println("Type: " + obj.getClass().getName()); } public static void main(String[] args) { Container<String> c1 = new Container<>("generic"); String s = c1.getObj(); System.out.println("String is: " + s); c1.showType(); Container<Integer> c2 = new Container<>(123); Integer i = c2.getObj(); System.out.println("Integer is: " + i); c2.showType(); } }