What are the advantages of using generics? (check all that apply) Data type consolidation Avoid unnecessary casting Stro
Posted: Mon Jun 06, 2022 1:17 pm
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>