Background:
Hey guys I'm making the first part of a greater program. We are instructed to create a program that stores a list of all our CD's. It has to be created in 3 different classes... that obviously link together.
My Question
How do I create an array that is filled with 10 songs that the user inputs? (under a method called addSongs)
- I've tried using import java.util.Scanner; but I don't believe a .nextString(); exists... I've used .nextInt(); before but not .nextString();
public class CD {
public CD ()
{
String[] redAlbum; // declares an array of strings
redAlbum = new String[10]; // sets memory to 10 strings
redAlbum[0] = /// something blank, " " maybe?
redAlbum[1] = /// something blank, " " maybe?
redAlbum[2] = /// something blank, " " maybe?
redAlbum[3] = /// something blank, " " maybe?
redAlbum[4] = /// something blank, " " maybe?
redAlbum[5] = /// something blank, " " maybe?
redAlbum[6] = /// something blank, " " maybe?
redAlbum[7] = /// something blank, " " maybe?
redAlbum[8] = /// something blank, " " maybe?
redAlbum[9] = /// something blank, " " maybe?
}
public static void addSongs (String [] redAlbum)
{
/// SOMETHING GOES HERE!!! I Need to input songs into the array redAlbum. How do I go about that?
}