My question to java folks is, when I am comparing two strings
imageName=new String[20];
....
imageName[1]="img1";
imageName[2]="img1";
if(imageName[1]==imageName[2])
{
//// codes
}
it works perfectly, but when I am making the string through number concatenation it's not working
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
}
it's not working though the values of j and k are the same
Thanks in advance for your solution