I'm trying to make a program where salesperson names have to be read and have to be stored in an array.
My biggest problem is that I do not know what the limit of names entered by the user is. So I used the while:
public static void main(String[] args)
{
Scanner ler = new Scanner(System.in);
String seller = "";
int x = 0;
String[] arr = new String[x];
while (!vendedor.equals("end"))
{
System.out.print("Vendedor: ");
vendedor = ler.next();
for (int indice = 0; indice < arr.length; indice++)
{
arr[indice] = ler.next();
System.out.print(arr[indice]);
}
}
}
Thank you!