/* * Beispiel zum Überladen von Methoden * * Die Ausgaben in den max-Methoden * dienen nur zum besseren Verständnis */ class MaxDemo2 { static int max (int x, int y) { System.out.println("Ich bin static int max (int x, int y)"); System.out.println("\tMeine Variablen: x="+x+", y="+y); if (x>y) { return(x); } else { return(y); } } static int max (int x, int y, int z) { System.out.println("Ich bin static int max " +"int x, int y, int z)"); System.out.println("\tMeine Variablen: x=" +x+", y="+y+", z="+z); int max; max = max(z, max(x,y)); return max; } public static void main (String[] arg) { System.out.println("Aufruf: max(45,13,98)"); System.out.println("Ergebnis: "+max(45,13,98)); } }