If I ask the user for input, how do I put it as the length of an array?
Example:
String teamnum = Input.nextLine();
int teams[]=new int[teamnum];
If I ask the user for input, how do I put it as the length of an array?
Example:
String teamnum = Input.nextLine();
int teams[]=new int[teamnum];
You need to cast the input as a integer also that's not the way you declare arrays. Try this:
String teamnum = Input.nextLine();
int newnum = Integer.parseInt(teamnum);
int[] teams = new int[newnum];