Does neone know the code instruction to store an array of CD objects. Each entry in the array has to be a single object describing a CD.

i.e: Artist Name , Album Name, Number of tracks

i've written the program out but i cannot seem to get the above right.
if you want to have a look at the full program its in my previous thread....

pleez pleez someone help me out i've been frustrated with this problem for two weeks now just cant seem to get it:

13 Years
Discussion Span
Last Post by NPH

Everything you need has been explained to you several times already. I don't see how regurgitating the same knowledge again will make any difference.


Suppose you want to create an array of <type> with size 1555.
<type> can stand for int, double, or String

The syntax is:

<type>[] nameOfTheArray = new <type>[1555];

This creates the 1555 empty slots. The actual contents depends on the type.

For example: an int array always starts with all 0's, a boolean array always starts with all false, a String arrray starts with all null. More generally, any Object array starts with all null.

//To make a CD object array of size 1555 write:
CD[] nameOfTheArray = new CD[1555];

//Then you must fill this array with some objects (right now its all null).
for(int i =0; i < nameOfTheArray.length; i++)
	//put a new CD object at position i
	nameOfTheArray[i] = new CD();

For more help, www.NeedProgrammingHelp.com

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.