Sign in

As a Java developer, it is very important to know what are the generics, its advantage, and when and how to use them.

What are Generics?

Generics are a facility of generic programming that were added to the Java programming language in 2004 within version J2SE 5.0.

What are the advantages of Generics?

Basically, there are 3 benefits of the Generics. They are

  1. Stroger Type check at the compile Time (Type Safety)
  2. Elimination of the Casting
  3. Enable Programmers to implement Generic Algorithm

Case I: Type Safety

To prove this case, We will first take an Array and how it enables…

Sagar Limbbu

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store