public static void main(String[] args) {
int LENGTH=0;
int currentSize=0;
String[] albumArray = new String[LENGTH];
Scanner sc = new Scanner(System.in);
System.out.println("How many tracks are in your album?");
LENGTH=sc.nextInt();
System.out.println("Thanks.");
System.out.println("Please enter " + LENGTH + " track names to add to the album: ");
//Prompts user to enter values until the array is filled. Repeats until filled.
while (currentSize < LENGTH){
System.out.print("Enter track name "+(currentSize+1)+":\t");
albumArray[currentSize] = sc.nextLine();
currentSize++;
}
for (int i =0; i<LENGTH;i++){
System.out.println(albumArray[i]);
System.out.println();
}
}
} …
Run Code Online (Sandbox Code Playgroud)