Generics add stability to your code, detectable more bugs at compile time (not at runtime). In a nutshell, generics enable types (classes and interfaces) to be parameters when defining classes, interfaces, and methods.
- Stronger type checks at compile time.
- Fixing compile-time errors is easier than runtime errors
- Elimination of casts.
- Enabling programmers to implement generic algorithms.