What are Generics in Java and How do they work? Explained with Examplesby@shahzaibkhan
395 reads

What are Generics in Java and How do they work? Explained with Examples

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

Generics were introduced in version J2SE 5.0 of Java in 2004. It is a pure compile-time concept. Generics allow developers to sort an array of objects and then invoke integer, double, and sting arrays to sort the elements. The Generics concept is called 'Generics' and is called a 'pure compile time concept' Generics offer us a cleaner, less generic code, no compile time safety, no downcast of objects, no runtime exceptions like 'classCastException'

Company Mentioned

Mention Thumbnail
featured image - What are Generics in Java and How do they work? Explained with Examples
Shahzaib Khan HackerNoon profile picture

@shahzaibkhan

Shahzaib Khan

Computer science student. Programming Geek


Receive Stories from @shahzaibkhan

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!