Normal
Ich habe jetzt probiert eine If-Anweisung zu geben, in der der maximale String herausgegeben wird:[code]String t = list.get(0); if (t == Collections.max(list)) { for (int i = 0; i < 5; i++) { System.out.println(list.get(t)); //Fehlermeldung! } }[/code]allerdings bekomme ich jetzt eine Fehlermeldung:The method get(int) in the type ArrayList<String> is not applicable for the arguments (String).Warum? Schließlich ist t als String definiert und nicht als int
Ich habe jetzt probiert eine If-Anweisung zu geben, in der der maximale String herausgegeben wird:
[code]String t = list.get(0);
if (t == Collections.max(list)) {
for (int i = 0; i < 5; i++) {
System.out.println(list.get(t)); //Fehlermeldung!
}
}[/code]
allerdings bekomme ich jetzt eine Fehlermeldung:
The method get(int) in the type ArrayList<String> is not applicable for the arguments (String).
Warum? Schließlich ist t als String definiert und nicht als int