What are the advantages of using generics? (check all that apply) Data type consolidation Avoid unnecessary casting Strong type checking Avoid code duplication
Consider the class definition public class Package<T>. Which of the following correctly instantiates the class with a generic argument of type Bottle? (check all that apply) Package<> p = new Package<Bottle>(); Package<Bottle> p = new Package<Bottle>(); Package<Bottle> p = new Package<>(); Package<T> p = new Package<T>();
Assume a class definition for a class named Truck. Which of the following answers have a valid generic parameter? (check all that apply) Truck<Load> Truck<int> Truck<L> Truck<T>
What are the advantages of using generics? (check all that apply) Data type consolidation Avoid unnecessary casting Stro
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What are the advantages of using generics? (check all that apply) Data type consolidation Avoid unnecessary casting Stro
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!