Computing.Net > Forums > Programming > Java Array

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Java Array

Reply to Message Icon

Name: bnm
Date: November 7, 2009 at 08:06:54 Pacific
OS: Windows XP
Subcategory: Java
Comment:

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!



Sponsored Link
Ads by Google

Response Number 1
Name: bnm
Date: November 7, 2009 at 08:07:29 Pacific
Reply:

It needs to be a for-loop.. HELP!


0

Response Number 2
Name: klint
Date: November 7, 2009 at 15:49:32 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Java Array

java arrays and reading from file www.computing.net/answers/programming/java-arrays-and-reading-from-file/14305.html

java arrays www.computing.net/answers/programming/java-arrays/10359.html

Java Array Of Date Objects...help www.computing.net/answers/programming/java-array-of-date-objectshelp/12294.html