I have a function which has the interface Comparable
as input parameter.
int sort(Comparable A[]){...}
Now I want to make a temporary variable of that type of which A
is at run time (might be Integer
or Float
, but I don't know), to do comparisons for my sorting algorithm.
How is it done? I'm a freshman to Java.
First, please don't use Raw Types. Second, I don't think you can but you could make a temporary variable of
Comparable
. Something like,