• All about Generics: Part 1

    Generics are used to parameterize types. A piece of code can be written generically enough so that we can fit a variety of types in it.  Being a strongly type-safe language, Java requires to specify types in all aspects of …

    Avatar photo
    Read more
  • Type Erasure Generics Java Challenge

    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!

    Read more

Subscribe to foojay updates:
Copied to the clipboard