dimanche 29 mars 2015

java string comparison not working [duplicate]


This question already has an answer here:




I am trying to compare two strings: totlwords & storage I claimed two variables under the class like below.



String[] totalwords = new String[2000];
String[] storage = new String[1000];


Especially, totalwords[0] is"good" and storage[0] is also "good". This is given in the below figure. enter image description here


It is supposed to give me "boom" instead of "good". I've been doing this couple of hours and now I'm really stuck at this difficult question. Please give me insight! :(



print("l:"+l+"count:"+countElement);
for( int m=0; m<l; m++){
for( int n =0; n<countElement; n++){
println("totalwords:"+ totalwords[start_old+n]+" storage:"+storage[m]);
if(totalwords[start_old+n]==storage[m]){
boolResult = 1;
totalwordsindex = start_old+n;
println("boom");
}
println("why???");

}
}

Aucun commentaire:

Enregistrer un commentaire