Generics is a mechanism for writing class code without identifying the data type(s) on which the class operates. It also enables you to construct type-safe data structures without having to commit to specific data types.