CLOSED
CLOSED
Started By Humphry, Nov 01 2019 07:39 AM
#1
Posted 01 November 2019 - 07:39 AM
#8
Posted 23 January 2020 - 01:54 PM
#8
Posted 23 January 2020 - 01:54 PM
Why on earth are you using a While cycle?
while(x<50){ System.out.print("Enter name: "); user[x] = val_Holder.nextLine(); x++; }
You could just turn it into a for:
for(int x=0;x<DIM;x++){ //Declared DIM as a constant System.out.print("Enter name: "); user[x] = val_Holder.nextLine(); System.println(); //you also forgot to add a line separator after receiving the input }
Also, i strongly reccomend you to dont use "System.out.println" to output variables, you should use instead "System.out.format("%[variable type]",[variable name]) since it handles variables far better than println does
Users browsing this thread: