Search:

Type: Posts; User: Norm

Search: Search took 0.09 seconds.

  1. Replies
    17
    Views
    1,645

    Re: Java IndexOutOfBound

    The printout should show what is in the list AFTER the item is added.
    The printouts show that three items were added to one bin and one item was added to the other.
    Then the getContents() method...
  2. Replies
    17
    Views
    1,645

    Re: Java IndexOutOfBound

    That looks like the same thing is being added to the llist three times. Is that correct? Which Bin is it being added to?



    This print out shows the list as always having 3 items in it? How...
  3. Replies
    17
    Views
    1,645

    Re: Java IndexOutOfBound

    What is printed out by the println statements you are using for debugging? Call println every time something is added to Bin A and Bin B to see what is placed in each bin.
  4. Replies
    17
    Views
    1,645

    Re: Java IndexOutOfBound

    Continue debugging the code by adding more printlns. If you print out the contents of the arraylists every time you add something to the arraylist, what is printed out will show you what is in the...
  5. Replies
    17
    Views
    1,645

    Re: Java IndexOutOfBound

    You can do that by adding some calls to the println() method to print out the contents of the ArrayList every time something is added to it. For example, Add this to the add() method and the...
  6. Replies
    17
    Views
    1,645

    Re: Java IndexOutOfBound

    Try debugging the code by adding printlns that print out the contents of the collections and variables so you can see what the computer sees when it executes the program.

    Print the contents of Bin...
  7. Replies
    17
    Views
    1,645

    Re: Java IndexOutOfBound

    It doesn't make sense to use a index that is past the end. The code needs to be changed so the index does not go past the end.
  8. Replies
    17
    Views
    1,645

    Re: Java IndexOutOfBound

    Which get() is causing the error? Look at the size of the collections connected to the get() methods being called.
  9. Replies
    17
    Views
    1,645

    Re: Java IndexOutOfBound

    If the array has a size of 1 then the maximum index is 0.

    Check the logic to make sure the index does not go past the array length-1
Results 1 to 9 of 9