Results 1 to 6 of 6
  1. #1
    drymsza1234 is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default Searching arrays

    Hello,

    I have a main class which is the menu and branches off to a few classes with execute's for each selection. I pass the array to the classes and need to search the array for different variables depending on the selection.

    array input ex : new PropertyListing(1445, 'L', "Orleans", "50 x 90 service lot", 50000)


    Say I'm searching for 1445 (listingNumber) how would I go about doing that? How would I match the listing number and the information with it?

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

    Default

    Loop over the array and check every PropertyListing for 1445.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    drymsza1234 is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default

    I have the while loop that loops through the entries and inListingNumber which is an int that the user enters

    while(i < curList.currentListings.length && !false)
    {
    if(inListingNumber == curList.currentListings[i])
    }

    is what I have but the if statement gives me an operand error

  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

    Default

    curList.currentListings[i] should be a PropertyListing. So I think you need
    Java Code:
    if (inListingNumber  == curList.currentListings[i].listingNumber)
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  5. #5
    drymsza1234 is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default

    Thanks!

    I had tried putting that in there but put it in the wrong place.

    Thanks again for the quick replies.

  6. #6
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

Similar Threads

  1. Searching in several fields
    By ivaneggel in forum Lucene
    Replies: 0
    Last Post: 11-11-2009, 10:24 AM
  2. Searching through a list.
    By wethekings in forum New To Java
    Replies: 3
    Last Post: 02-24-2009, 01:43 PM
  3. Searching Arrays
    By BHCluster in forum New To Java
    Replies: 3
    Last Post: 07-26-2008, 06:55 AM
  4. Problem with searching while using GUI
    By BHCluster in forum AWT / Swing
    Replies: 1
    Last Post: 04-24-2008, 07:56 PM
  5. searching
    By nalinda in forum New To Java
    Replies: 3
    Last Post: 12-06-2007, 03:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •