i created my problem and I don't have any solution, HEEELLPP
Hello, recently i just created my own problem and i cannot solve where i need to put a number to register a specific numbers of people. -> What i am trying to do is... i am going to input a specific number, example 5. So lets say i will register 5 person in the code below. then what i want to do is to printout those 5 names after the loop turns into false. The problem is i can't declare(im not sure for the term) the variable inside the loop to printout those names. Or maybe i need to make variable names[] to arry so that the names will printout? Thank you â€ïž Ps: more exmple arry pls import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int howMany; System.out.print("Input number on how many people will be register: "); howMany = input.nextInt(); String names[] = new String[howMany]; int x = 0; while (x <= howMany) { String name = input.nextLine(); System.out.print("Enter name: "); x++; } } }