0

Java Generics

I Try to convert my method in java into a generic method, but it does not work. My problem is, that i have two data types as Parameter. My method is: public static int whichInt(int[] a, char[] b) { ... My solution was something like this: public static <T,S extends Comparable<T,S>> int whichint(T[]a, S[] b){ ... Does somebody know how to write this method correctly? Best regards, stefano

28th Mar 2017, 5:33 PM
Stefan Hasse
Stefan Hasse - avatar
2 Answers
7th May 2017, 8:49 AM
Tashi N
Tashi N - avatar
0
Hi Stefano, Try this way: public static <T extends Comparable<T>,S extends Comparable<S>> int whichint(T[]a, S[] b) { ... }
29th Mar 2017, 1:08 PM
Rodrigo Faria
Rodrigo Faria - avatar