Normal
Entferne das Semikolon am Ende von [ICODE]if (max<a2[j]);[/ICODE]Korrekt eingerückt/formatiert (z.B. mit einer vernünftigen IDE) würde dein Code so aussehen:[code=java] public void max(int[] a2) { int max = a2[0]; for (int j=0; j<a2.length; j++) { if (max < a2[j]) ; // <- mache nichts. Das leere Statement. max = a2[j]; } System.out.println("Das Maximum ist: " + max); System.out.println(); }[/code]
Entferne das Semikolon am Ende von [ICODE]if (max<a2[j]);[/ICODE]
Korrekt eingerückt/formatiert (z.B. mit einer vernünftigen IDE) würde dein Code so aussehen:
[code=java]
public void max(int[] a2) {
int max = a2[0];
for (int j=0; j<a2.length; j++) {
if (max < a2[j])
; // <- mache nichts. Das leere Statement.
max = a2[j];
}
System.out.println("Das Maximum ist: " + max);
System.out.println();
[/code]