Generics enable types (classes and interfaces) to be parameters when defining classes, interfaces, and methods.
Source Code
class MyGenericClass {
private T obj;
public void set(T obj) { this.obj = obj; }
public T get() { return obj; }
}