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:

T calculateAnswer(T input)

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) void printResult(T result)
c) void printResult(T input)
d) void printResult(Animal input)

3) Using a wildcard, convert the signature for the following method to take ArrayLists of Numbers and its subclasses:

double product(ArrayList input)

a) double product(ArrayList input)
b) double product(ArrayList input)
c) double product(T input)
d) double product(ArrayList input)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!