Question: Java 1) Java uses erasure to convert the method signature: T calculateAnswer(T input) to what? a) String calculateAnswer(String input) b) T calculateAnswer(T input) c) Object
Java
1) Java uses erasure to convert the method signature:
to what?
| a) | String calculateAnswer(String input) |
| b) | T calculateAnswer(T input) |
| c) | Object calculateAnswer(Object input) |
| d) | int calculateAnswer(int input) |
2)Use generics to convert the signature of the method:
void printResult(Dog input)
to accept as input any object that is of type Animal, or is a subclass of Animal.
| a) | void printResult(Animal input) |
| b) |
| c) |
| d) |
3) Using a wildcard, convert the signature for the following method to take ArrayLists of Numbers and its subclasses:
double product(ArrayList
| a) | double product(ArrayList extends Number> input) |
| b) | double product(ArrayList> input) |
| c) |
| d) | extends Number> double product(ArrayList> input) |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
