What are generics in Java?

Solution:

Generics are a mechanism that enables types to be parameters of the class, interface or method definition. This mechanism allows reusing of the same code with different inputs, while providing compile-time checks.

0 answers