Printing results from another class
I have two classes Books and Customers
the idea is a book shop I'm trying to get each object on the Book class to match a object on the Customers class so for example I can call a print customer method on the Book class to see what customer bought that book but how do I link two classes together and get the fields from one class to another?
Re: Printing results from another class
Usually classes hold variables of other types or collections such as arrays, Maps, or Lists such as ArrayLists of other types, and the containing class can then call the methods of the contained objects.
For instance, a BookStore class could hold an ArrayList of Book objects, and a customer could have a ShoppingCart filled with some of these Books (also held in an ArrayList).