Search:

Type: Posts; User: Norm

Search: Search took 0.15 seconds.

  1. Replies
    15
    Views
    1,414

    Re: Adding Object to ArrayList

    Should the name of the method be: addBook() if it adds a book object to the list.
  2. Replies
    15
    Views
    1,414

    Re: Adding Object to ArrayList

    If the addItem() method is in the Book class,
    then why does it create a Book object?

    Did you change the code to:
    1) create a book object
    2) add info to the book object
    3)add the book object...
  3. Replies
    15
    Views
    1,414

    Re: Adding Object to ArrayList

    Does the addItem() method add some item to some list? It looks like it should take all the data it receives as args, create an object with the data and add that object to a list.
    Is that what it...
  4. Replies
    15
    Views
    1,414

    Re: Adding Object to ArrayList

    What class is the newBook variable? Does it have an addItem() method?
    Does the code posted in post#9 compile without errors?
  5. Replies
    15
    Views
    1,414

    Re: Adding Object to ArrayList

    You need to create a Book object, store all the info in the Book object and then add it to the arraylist.
  6. Replies
    15
    Views
    1,414

    Re: Adding Object to ArrayList

    They should be using a Book object to do that.
    When all the info has been stored in the Book object, Then the Book object that now contains all the info should be added to the arraylist.

    Where...
  7. Replies
    15
    Views
    1,414

    Re: Adding Object to ArrayList

    newBook.get(x).setId(newId);
    newBook.get(x).setDate(newDate);

    What are these statements doing? It looks like they are calling the Book class's methods after the Book object has been added to...
  8. Replies
    15
    Views
    1,414

    Re: Adding Object to ArrayList

    Can you explain what trouble you are having? Post the full text of any error messages.
    Make the calls to the Book class's methods before adding the Book class object to the arraylist.

    Where does...
Results 1 to 8 of 8