Home Segments Top Top Previous Next

522: Mainline

Whenever you create an array of class instances, all the elements in the array are initialized to a value that represents the absence of an instance. That value is denoted as null. Thus, if you want a program to determine whether it has written into an array of instances at a particular place, you compare the value obtained from that place with null. If the value obtained from a place is null, you have yet to write an instance into that place:

movies[counter] == null