Wie kann man den folgenden Code kürzen, sodass trotzdem alle Kombis angezeigt werden?
import java.util.Scanner;
public class Reihenfolge {
public static void main(String[] args) {
System.out.print("Ein Wort mit 3 Zeichen eingeben: ");
Scanner scan = new Scanner(System.in);
char a = scan.findWithinHorizon(".", 0).charAt(0);
char b = scan.findWithinHorizon(".", 0).charAt(0);
char c = scan.findWithinHorizon(".", 0).charAt(0);
System.out.print(a); System.out.print(b); System.out.print(c); System.out.println(" ");
System.out.print(a); System.out.print(c); System.out.print(b); System.out.println(" ");
System.out.print(b); System.out.print(a); System.out.print(c); System.out.println(" ");
System.out.print(b); System.out.print(c); System.out.print(a); System.out.println(" ");
System.out.print(c); System.out.print(b); System.out.print(a); System.out.println(" ");
System.out.print(c); System.out.print(a); System.out.print(b);
scan.close();
}
}
import java.util.Scanner;
public class Reihenfolge {
public static void main(String[] args) {
System.out.print("Ein Wort mit 3 Zeichen eingeben: ");
Scanner scan = new Scanner(System.in);
char a = scan.findWithinHorizon(".", 0).charAt(0);
char b = scan.findWithinHorizon(".", 0).charAt(0);
char c = scan.findWithinHorizon(".", 0).charAt(0);
System.out.print(a); System.out.print(b); System.out.print(c); System.out.println(" ");
System.out.print(a); System.out.print(c); System.out.print(b); System.out.println(" ");
System.out.print(b); System.out.print(a); System.out.print(c); System.out.println(" ");
System.out.print(b); System.out.print(c); System.out.print(a); System.out.println(" ");
System.out.print(c); System.out.print(b); System.out.print(a); System.out.println(" ");
System.out.print(c); System.out.print(a); System.out.print(b);
scan.close();
}
}