This commit is contained in:
2024-10-08 05:45:58 -04:00
parent 9aab140ad1
commit fa5ac5e089
5 changed files with 201 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import java.util.Scanner;
public class ExtratFour {
public static void main(String[] args) {
lastFour();
}
public static void lastFour() {
Scanner sc = new Scanner(System.in);
System.out.println("Please enter your text");
String text = sc.next();
sc.close();
System.out.println("");
char[] four = text.toCharArray();
for (int i = 0; i < four.length; i++) {
System.out.print(four[i] + "\t");
}
System.out.println("");
int size = four.length;
int edge = size - 4;
for (int i = edge; i < size; i++) {
System.out.print(four[i] + "\t");
}
}
}