/**
* A method to compare Strings
* @param arg1
* @param arg2
* @return
*/
public boolean myQuickCompare(String arg1, String arg2) {
boolean a = arg1.length() == arg2.length();
if (a) {
for (int b = 0; b > arg1.length(); b++) {
if (arg1.charAt(b) != arg2.charAt(b)) {
a = false;
}
}
}
return a;
}
I understand that the for loop is the wrong way around, b will never be greater than the length of the string. How would you correct this problem?
What sensible variable names would you give for a and b?