Sobes.tech
Junior

Have generics always existed in Java?

sobes.tech AI

Answer from AI

No, generics appeared in Java starting from version 5.0. Before that, collections could only store objects of type Object, which required type casting and led to runtime errors (Runtime Exceptions). Generics introduced compile-time type safety.