What are the advantages of using generics? (check all that apply) Data type consolidation Avoid unnecessary casting Stro
-
- Site Admin
- Posts: 899603
- 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
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>