I am trying to create an array of type Library , where I can store many objects of type Library , which I will use later. Before I get too much, I try to make the print() method in an array so that I can just call myLibrary.print() to print the array.
public class Library {
I get an error that there is no print() on Library[] .
How can I print this array? Will I just scroll the array in the main file and cause a separate print on each object? If so, where will I write my own methods to sort the array?
UPDATE
Requirements for my assignment: "Your program will use one array of type library to store all the information read from the input file."
"At the top level, you will have the Library class. The library will have three subclasses: Music, Book and Movie. Music will have two subclasses: Song and Album., Fiction, Nonfiction, Song and Album will not have any subclasses."
UPDATE 2
This is for the CS-101 course. I do not feel that I need to use Comparable.
source share