Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Replies
    11
    Views
    1,152

    Re: returning an integer

    Glad you got it working.
  2. Replies
    11
    Views
    1,152

    Re: returning an integer

    Do you mean that the program is executing an endless loop?
    Add some println statements to find out where it is looping and what the values of the variables are that would keep it from exiting the...
  3. Replies
    11
    Views
    1,152

    Re: returning an integer

    The code you posted did NOT use a value returned by a method to define the size of the array.
    To get a value from the method, the code would be:

    evenCount = read(array, evenCount);

    What did...
  4. Replies
    11
    Views
    1,152

    Re: returning an integer

    Here's an example of how to set an array size using a value returned by a method:

    int size1 = kybd.nextInt();
    int[] array = new int[size1];
  5. Replies
    11
    Views
    1,152

    Re: returning an integer

    What array is being indexed at line 79? The error message says that the array is empty because it does not have a first element at index 0.

    Add a println to print out the .length of all arrays...
  6. Replies
    11
    Views
    1,152

    Re: returning an integer

    Please post the full text of the error message. It shows where the exception happened and the value of the index.

    Remember that array indexes range from 0 to the array length-1
Results 1 to 6 of 6