Hey guys! I'm writing this really long code for practice. Got really rusty with Java so I gotta get brain working again. Anyway, the first part of the code asks the user for the number of employees; the for loop then keeps asking the user to input employee names depending on the value of user input. The error I'm getting is that I haven't intialized arrayEmp. How do I make it so that the size of arrayEmp is from the user's input. Thanks guys! Every time I come to this site I just keep on learning!
public class Driver {
public static void main(String[] args) {
String[] arrayEmp;
String empName;
double numSales;
double numCom;
Scanner s = new Scanner (System.in);
System.out.print("Input number of employees: ");
int numEmp = s.nextInt();
for(int i = 0; i < numEmp; i++){
System.out.print("Enter employee name: ");
empName = s.next();
arrayEmp[i] = empName;
}
}