Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Re: Trying to read objects from file into ArrayList

    The print out shows that it reads two lines. When it gets the exception that throws it out of the loop.
    If it didn't get the exception, it should continue reading lines as long as sc.hasNextLine()...
  2. Re: Trying to read objects from file into ArrayList

    Ok, that says the first time the array has the 5 elements shown in the print out. Are those the expected values?
    The second time it says that there are no elements in the array. What is in the...
  3. Re: Trying to read objects from file into ArrayList

    Add that statement after the split method call to see what was in the array that was created.
  4. Re: Trying to read objects from file into ArrayList

    No, the code says 4 elements.


    String[] details = new String[4]; // Define array to hold 4 Strings
    details = line.split(" "); // Create new array with the split method
    ...
  5. Re: Trying to read objects from file into ArrayList

    At line 98 the code tries to access an array with an index past the end of the array. The array needs to have at least two elements to be able to index it with an index of 1.
    What is the size of...
Results 1 to 5 of 5