Answer:
Step-by-step explanation:
The following code is written in Java. It asks the user for a string/sentence and then grabs every character in the string, capitalizes it, and saves it in a char ArrayList. Then it concatenates the char array into a String variable called output and prints the capitalized String.
public static void capitalizeMe() {
Scanner in = new Scanner(System.in);
System.out.println("Enter a String:");
String inputSentence = in.nextLine();
ArrayList<Character> capitalString = new ArrayList<Character>();
for (int x = 0; x < inputSentence.length(); x++) {
capitalString.add(Character.toUpperCase(inputSentence.charAt(x)));
}
String output = "";
for (char x: capitalString) {
output += x;
}
System.out.println(output);
}