Java string comparison is not working when concatenated with number
<p>My question to java folks is, when I am comparing two strings </p>

<pre><code>imageName=new String[20];    
....    
imageName[1]="img1";  
imageName[2]="img1";  

if(imageName[1]==imageName[2])  
{  
 ////  codes  
}
</code></pre>

<p>it works perfectly, but when I am making the string through number concatenation it's not working</p>

<pre><code>imageName=new String[20];  
int j=1,k=1;  
imageName[1]="img"+j;  
imageName[2]="img"+k;

 if(imageName[1].toString()==imageName[2].toString())     
        {  
           ////  codes  
        }  
</code></pre>

<p>it's not working though the values of j and k are the same</p>

<p>Thanks in advance for your solution</p>
