The loop continues prompting until the user enters an integer greater or equal to 5. (Actually, 5 is dangerously small for a password.)
Next, the program assembles a string of all the characters that could go into a password:
String choices = "abcdefghijklmnopqrstuvwxyz" ; choices = choices + choices.toUpperCase() ; choices = choices + "1234567890" ;
The first of these three statements creates a string literal containing the
lower case alphabet.
Then the expression choices.toUpperCase()
creates a string that
is all upper case, based on the string currently referred to by choices
.
This string is then concatenated onto the original choices
string:
choices = choices + choices.toUpperCase();
Recall that +
means "string concatenation".
Finally, the string "1234567890"
is concatenated onto the string to produce the
final string, shown below:
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
Would the statement
choices = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
have worked as well?