1 // Verzweigung.java
2 import java.util.Scanner;
3
4 /** 5 * Verzweigung liesst zwei Zahlen ein und gibt das Maximum aus. 6 * Beispielprogramm zur Programmiertechnik 1, Teil 3. 7 * @author H.Drachenfels 8 * @version 17.3.2023 9 */
10 public final class Verzweigung {
11 private Verzweigung() { }
12
13 private static final Scanner EINGABE = new Scanner(System.in);
14
15 /** 16 * main ist der Startpunkt des Programms. 17 * @param args wird nicht verwendet. 18 */
19 public static void main(String[] args) {
20 System.out.print("Zwei Zahlen eingeben: ");
21 int m = EINGABE.nextInt();
22 int n = EINGABE.nextInt();
23
24 if (m == n) {
25 System.out.println("Beide Zahlen sind gleich!");
26 } else if (m > n) {
27 System.out.printf("Maximum: %d%n", m);
28 } else {
29 System.out.printf("Maximum: %d%n", n);
30 }
31 }
32 }
33