Search:

Type: Posts; User: curmudgeon

Search: Search took 0.09 seconds.

  1. Replies
    30
    Views
    2,219

    Re: Need help with creating method for Array.

    Exactly. Remember that arrays are 0 based, and so if an array has length of 8, it will hold items in spots using indices 0 to 7. When you loop until i < myArray.length your for loop stops before the...
  2. Replies
    30
    Views
    2,219

    Re: Need help with creating method for Array.

    Please look carefully at your for loop vs. mine. There is a critical difference.
  3. Replies
    30
    Views
    2,219

    Re: Need help with creating method for Array.

    Arrays have a length field that should be used:



    // for array myArray...
    for (int i = 0; i < myArray.length; i++) {

    }
  4. Replies
    30
    Views
    2,219

    Re: Need help with creating method for Array.

    Your code will tell you what you're returning. What variable are you returning? What type is it? I've been trying to get you to look critically at this method. Please do so. Why are you creating an...
  5. Replies
    30
    Views
    2,219

    Re: Need help with creating method for Array.

    So you understand that the method requires that an array be passed into it, and you're not passing in an array, right? You're passing in a single String. So look to see where you get that single...
  6. Replies
    30
    Views
    2,219

    Re: Need help with creating method for Array.

    The error message tells you what the problem is. Look at how the printArray method is defined ---



    public static void printArray(String[] displayed)
    {

    String[] list = new...
Results 1 to 6 of 6