Question: HELP Generics are important to Java because they enable the creation of code that is a: Type-safe , b:Reusable, C: Reliable, D:all the above. Can
HELP
Generics are important to Java because they enable the creation of code that is
a: Type-safe , b:Reusable, C: Reliable, D:all the above.
Can a primitive type be used as a type argument?
| a. | Yes, if the argument has more than one parameter |
b.Yes, only primitive type can be used as a type argument
c. No, type argument must be object types
d.Yes, type argument does not have to be object types
Show how to declare a class called FlightSched that takes two generic parameters.
a.class FlightSched<>{T, V},
| b. | class FlightSched(V, T) { |
c.class FlightSched
d.class FlightSched
Can the wildcard argument be bounded?
a.Yes, a wild card must have a lower bound only
| b.Yes, a wild card must have an upper bound only |
c.No, a wild card argument cannot be bounded.
d.Yes, a wild card can have either an upper or lower bound
.Do type parameters exist at run time?
a.No, some type parameters are erased during runtime
b.No, all type parameters are erased during compliation, and appropriate casts are substituted
c.Yes, all type parameters exist at run time
d.No, all type parameters are erased during runtime, and appropriate casts are substituted| interface, polymorphism
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
