Results 1 to 2 of 2
- 10-30-2011, 05:08 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 9
- Rep Power
- 0
Printing results from another class
Hi,
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?
Thanks
-
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).
Similar Threads
-
Help with printing an arrayList. printing the first element twice
By kingkongjaffa in forum New To JavaReplies: 9Last Post: 08-19-2011, 12:59 AM -
Vector results need to be available to another class
By Paul_White in forum New To JavaReplies: 6Last Post: 05-07-2011, 07:45 PM -
printing string backwards and printing every other
By droidus in forum New To JavaReplies: 22Last Post: 03-10-2011, 09:17 AM -
Sometimes get the right results sometimes dont
By Battlefeldt in forum New To JavaReplies: 0Last Post: 12-18-2009, 01:03 AM -
Java results in Excel
By puk284 in forum New To JavaReplies: 1Last Post: 04-21-2009, 04:13 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks