Rafael Winterhalter 6/15/2013

Subtyping in Java generics

Read Original

This technical article delves into subtyping within Java's generic type system. It explains why generic types of the same class (e.g., List<Number> and List<Integer>) do not form a subtype hierarchy, using examples to illustrate type safety and the prevention of ClassCastExceptions. The discussion includes the role of types in adding redundancy and safety to programs.

Subtyping in Java generics

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week