W książce Java.Podstawy edycja 9 strona 632 jest taki mniej wiecej kod z błędem?
public class ArrayAlg {
public static void main(String[] args) {
// TODO Auto-generated method stub
String middle = ArrayAlg.getMiddle("jan","s","Kowalski");
System.out.print(middle);
}
public static <T> T getMiddle(T[] a){
return a[a.length/2];
}
}
eclipse wypluwa taki blad Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method getMiddle(T[]) in the type ArrayAlg is not applicable for the arguments (String, String, String)
Autor chyba powinien wywołać funkcje ArrayAlg.getMiddle( new String[]{"jan","s","kowalski"}) .
Mam pytanie jak to możliwe że to edycja 9 i jeszcze tego nie poprawiono?