Generics Quiz 1
The quiz below tests your knowledge of the material learnt in Generics - Lesson 1 - Generic Basics.
Question 1 : In which version of Java were Generics added to the language
- Generics were added to Java in version 5.0.
Question 2 : When we talk about generics or a generic type what we are actually talking about?
- When we talk about generics or a generic type what we are actually talking about is a <i>parameterized type</i>.
Question 3 : How are generics implemented?
- Generics are implemented by <i>erasure</i> (all generic code is removed at compile time) so legacy code can interoperate with generic code.
Question 4 : When creating your own generic types it is best practice to use pneumonics for the formal type parameter rather than multiple letters?
- When creating your own generic types IT IS best practice to use pneumonics for the <i>formal type parameter</i> rather than multiple letters.
Question 5 : What is the advantage of using generics
- The advantage of using generics is type safety.
Question 6 : Which operator was introduced in Java 7 to aid with verbosity when using generics?
- The diamond operator was introduced in Java 7 to aid with verbosity when using generics.
Question 7 : Generics have stopped the use of raw types?
- To keep Java backward compatible YOU CAN still use raw types instead of generics although this is in no way recommended!
Quiz Progress Bar Please select an answer
What's Next?
In the next quiz we test your knowledge of raw and generic types and the advantages of using generic types.