Generics are given the ability to create generalized classes, interfaces and methods by operating through references of type Object . It provides compile-time type safety that allows programmers to catch invalid types at compile time and also expand ability to reuse code.
Generics CODE class SampleGenericsDemo OUTPUT Type of T is : java.lang.Integer DESCRIPTION In this program contains two classes. One class is generic class i.e. THINGS TO TRY
|