ras_pari
September 25th, 2009, 05:25 AM
String b=1;
I have to ask a question .....that how to compare a string array and a string variable...I am using equals()...but that is not working.....My code is as follows..
for(int j=0; j< splits.length ;j++){
if (splits[j].equals(b)) {
System.out.println("The strings are equal.");
} else {
System.out.println("The strings are unequal.");
}
}
Here splits is a string array...b is a string variable......I want to compare this string variable and split array....
I have to ask a question .....that how to compare a string array and a string variable...I am using equals()...but that is not working.....My code is as follows..
for(int j=0; j< splits.length ;j++){
if (splits[j].equals(b)) {
System.out.println("The strings are equal.");
} else {
System.out.println("The strings are unequal.");
}
}
Here splits is a string array...b is a string variable......I want to compare this string variable and split array....