Type Erasure Generics Simpson Java Challenge

java generics method

It’s possible to use type erasure generics in a method with Java. To know how to use generics is important because then you are able to create highly reusable code. In the following Java Challenge, you will see the generic type that will be erased by the compiler and then will be replaced by the type we defined at runtime.

Note also that we are using the extends keyword which means that the generic type will extend the other type.

Without further ado, it’s time to solve the Java Challenge quiz!

It's time to improve your Java skills with this Type Erasure Generics Simpson Java Challenge - Quiz 36366

Type Erasure Generics Simpson Java Challenge

What will happen when running the following code?

generics type erasure

That’s it challenger, rock on! Keep taking action and relentlessly break your limits! Don’t hesitate to leave a comment with a question if anything is not clear!

Written by
Rafael del Nero
Join the discussion