Jack Kirby Jack Kirby - 7 months ago 66
Java Question

Read char array, one char at a time

My program saves user input as a string (UI), then splits it into an array

char[] charArray = UI.toCharArray();
After this the program needs to read the first letter in
, use it for different part of the program, and then proceed to the next letter in the array. The problem is reading the array one letter at a time.

How do you read a char array one character at a time?


If you want to reduce your work, you don't even need the char array.

for(int i = 0 ; i < UI.length() ; i++) {
    char c = UI.charAt(i);
    // Your remaining code