I need a program that asks the user to introduce up to 10 names (to end, the user could type "fim" [that is end in Portuguese]).
My current problem is how to terminate the program if the user reach 10 names.
Here is my main function:
public static void main(String[] args) {
Scanner keyboard = new Scanner (System.in);
System.out.println("Introduza até 10 nomes completos com até 120 caracteres e pelo menos dois nomes com pelo menos 4 caracteres: ");
String nome = keyboard.next();
for(int i = 0; i < 10; i++) {
while(!nome.equalsIgnoreCase("fim") && i<10) {
nome = keyboard.next();
}
}
keyboard.close();
}