Hey guys! I'm trying to create a program that first asks the user for an integer input n. The program will then ask the user for n Strings and store these in the array. This is what I have so far:
public static void main (String args[]){
String[] strArray;
int num;
Scanner sc = new Scanner(System.in);
System.out.print("Enter an integer: ");
num = sc.nextInt();
for(int i = 0; i < num; i++){
System.out.print("Enter String: ");
String str = sc.next();
strArray[0] = str;
}
System.out.print(strArray[0]);
}
}