Java Probably trivial problem

Discussion in 'General Computer Support' started by frubeng, Dec 4, 2009.

  1. frubeng

    frubeng

    Joined:
    Dec 4, 2009
    Messages:
    1
    Hello,

    I have a method that reads in a String variable called "mid". This variable can take different forms such as:

    ""
    "UBSS"
    "TMBR"

    I want to find if this string already exists in my array declared as:
    public static int ecn_no=10;
    public static String[] ECNs= new String[ecn_no];
    This array is initialized to have "!ecns" as each element.

    I have the following loop:
    for (i=1; i<ecn_no;i++){
    if (ECNs=="!ecns"){
    ECNs=mmid;
    a=i;
    break;
    } else {
    if (ECNs==mmid){
    a=i;
    break;
    }
    }
    }
    Hence, if the "mid" doesnt exist, it it stored, and if it is already in ECNs, then a just takes on the index as its value.

    However, the problem I am seeing is that regardless of what "mid" is, it NEVER passes "if (ECNs==mmid)" even though i can see in the debugger that they are equal.

    What am i doing wrong!?

    Thank you very much!

    Frubeng
     
    frubeng, Dec 4, 2009
    #1
    1. Advertising

  2. frubeng

    rmugalaasi

    Joined:
    Dec 23, 2009
    Messages:
    1
    I have a problem connecting web bsaed forms together developed in NetBeans 6.1
     
    rmugalaasi, Dec 23, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. to-X-ic
    Replies:
    9
    Views:
    598
    Gary G. Taylor
    Jul 7, 2003
  2. Claude Balls

    Trivial trivia time

    Claude Balls, Sep 10, 2003, in forum: Computer Support
    Replies:
    3
    Views:
    802
    Claude Balls
    Sep 10, 2003
  3. Nick \(UK\)

    Trivial But Irritating

    Nick \(UK\), Dec 28, 2003, in forum: Computer Support
    Replies:
    3
    Views:
    1,863
    Nick \(UK\)
    Dec 28, 2003
  4. DeMoN LaG

    Re: Trivial question on purchasing a computer case

    DeMoN LaG, Oct 14, 2003, in forum: Computer Information
    Replies:
    1
    Views:
    961
    Larry Smith
    Oct 14, 2003
  5. iiiiiieeeeee
    Replies:
    1
    Views:
    453
    What's in a Name?
    Mar 12, 2007
Loading...

Share This Page