Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I need to make an array in one class 'Library' and fill it with 'textBook' objects from the other class 'TextBook'. I have my iterator, 'nextBook'... well here is so far...
public class Library
{
private TextBook[] bookShelf;
private int nextBook;
private int cardHolders;
public Library (int bookLimit)
{PLEASE HELP!

You have a constructor that takes the size of your library (the maximum number of books it has) so you need to initialise your array to be an array of that number of books. Then initialise nextBook to be at the start of the array, because that's where you will store the next book. You will need to think about how you add books to the library.

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |