D
DaMaxx
Gast
Hallo, habe folgendes Problem:
Ich will nach diesem Programmabschnitt
die jeweils ersten und letzten drei buchstaben jeweils in ein array packen!
Also quasi so: Ich tippe Autobahn ein und er gibt "aut" und "ahn" aus und packt "aut" ins array "erst" und "ahn" ins array "letzt"
Wie stell ich das am besten an?
Danke schonmal für die Hilfe
Ich will nach diesem Programmabschnitt
Code:
System.out.println();
System.out.println("Die letzten drei Buchsatben der 5 Woerter sind:");
System.out.println();
System.out.println("1.Wort: "+wort[0].charAt(wort[0].length()-3)
+wort[0].charAt(wort[0].length()-2)
+wort[0].charAt(wort[0].length()-1));
erst[0] =
System.out.println();
System.out.println("2.Wort: "+wort[1].charAt(wort[1].length()-3)
+wort[1].charAt(wort[1].length()-2)
+wort[1].charAt(wort[1].length()-1));
System.out.println();
System.out.println("3.Wort: "+wort[2].charAt(wort[2].length()-3)
+wort[2].charAt(wort[2].length()-2)
+wort[2].charAt(wort[2].length()-1));
System.out.println();
System.out.println("4.Wort: "+wort[3].charAt(wort[3].length()-3)
+wort[3].charAt(wort[3].length()-2)
+wort[3].charAt(wort[3].length()-1));
System.out.println();
System.out.println("5.Wort: "+wort[4].charAt(wort[4].length()-3)
+wort[4].charAt(wort[4].length()-2)
+wort[4].charAt(wort[4].length()-1));
System.out.println();
System.out.println("Die ersten drei Buchsatben der 5 Woerter sind:");
System.out.println();
System.out.println("1.Wort: "+wort[0].charAt(0)
+wort[0].charAt(1)
+wort[0].charAt(2));
System.out.println();
System.out.println("2.Wort: "+wort[1].charAt(0)
+wort[1].charAt(1)
+wort[1].charAt(2));
System.out.println();
System.out.println("3.Wort: "+wort[2].charAt(0)
+wort[2].charAt(1)
+wort[2].charAt(2));
System.out.println();
System.out.println("4.Wort: "+wort[3].charAt(0)
+wort[3].charAt(1)
+wort[3].charAt(2));
System.out.println();
System.out.println("5.Wort: "+wort[4].charAt(0)
+wort[4].charAt(1)
+wort[4].charAt(2));
die jeweils ersten und letzten drei buchstaben jeweils in ein array packen!
Also quasi so: Ich tippe Autobahn ein und er gibt "aut" und "ahn" aus und packt "aut" ins array "erst" und "ahn" ins array "letzt"
Wie stell ich das am besten an?
Danke schonmal für die Hilfe