Java Question. Please provide a correct solution with steps. Will provide a thumbs up for correct solution. Answer as soon as possible.
What is type argument inference? Why does a generic method look like an indefinite overloaded method?
Type argument inference is a process performed by the compiler to determine the actual type argument for a type parameter when invoking in a generic method.
Example of generic method:
-----------------------------
static <T> T add(T a1, T a2) {
return a1+a2;
}
Example of overloaded methods according to above generic method:
------------------------------------------------------------------
static int add(int a1, int a2){
return a1+a2;
}
static float add(float a1, float a2){
return a1+a2;
}
.....
.....
static String add(String a1, String a2){
return a1+a2;
}
So, From the above we can say that if we write all indefinite overloaded methods then that will equals to the above genetic method.
Java Question. Please provide a correct solution with steps. Will provide a thumbs up for correct...