What Are Generics In Java

My younger cousin asked me what “generics” are in Java. I thought about it for a while, and I realized that in order to give a proper explanation, the following topics need to be understood first:

  1. Runtime VS Compile Time errors
  2. Inheritance
  3. Polymorphism

1. Runtime VS Compile Time Errors

Compile Time Errors

In a modern IDE, such as Eclipse or IntelliJ, you have a compile-time error if your code is marked by a red line:

--

--

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
janac

Most of my writing is about software. I enjoy summarizing and analyzing books and self-help videos. I am senior software consultant at LazerTechnologies.com.