Home Segments Top Top Previous Next

542: Mainline

Suppose, for example, that you decide to repackage the file-reading and array-storing apparatus into a method named readData. You write readData, a class method that both accepts and returns an array of Movie instances:

                *-- Returned value is a movie array 
                | 
                |                      *-- Parameter name 
                |                      | 
                |                      |     *-- Parameter type 
                v                      v     v   is array 
              ------- --------       ------ -- 
public static Movie[] readData(Movie movies []) throws IOException { 
 ... 
} 

Equivalently, you can place the brackets in front of the parameter name:

public static Movie[] readData(Movie[] movies) throws IOException { 
 ... 
}