Search:

Type: Posts; User: jps

Search: Search took 0.10 seconds.

  1. Replies
    17
    Views
    1,866

    Re: How To Use Linear Search

    Read the API for the Integer class. Search keywords java autoboxing.

    I liked the way this program was looking when it was dealing with int[] rather than Vector<Integer>, but either way can work....
  2. Replies
    17
    Views
    1,866

    Re: How To Use Linear Search

    If I remember correctly you were using this the first time around. I have not been following this thread very closely, but aren't you trying to generate two integers (die roll) and compare the...
  3. Replies
    17
    Views
    1,866

    Re: How To Use Linear Search

    The .equals method checks to see if two objects are the same exact object (pointer to the same place in memory). This is not the same thing done by the == operator
  4. Replies
    17
    Views
    1,866

    Re: How To Use Linear Search

    System.out.println("index is: " + sumArray[i]);
    i would be the index, sumArray[i] would be the value at index i within the array.
    Or do I not understand you correctly?
  5. Replies
    17
    Views
    1,866

    Re: How To Use Linear Search

    for (int j = 0; j < a-1; j++){

    if (sum == sumArray[j]){
    System.out.println("You win!");
    break;
    }
    }
    What is this doing?
    Does the code compile and run? What seems to be...
Results 1 to 5 of 5