「java入門」Objectクラスを利用する方法
javaコード:
public boolean equals(Object anObject) {
if (this == anObject) {
return true;
}
if (anObject instanceof String) {
String anotherString = (String)anObject;
int n = value.length;
if (n == anotherString.value.length) {
char v1[] = value;
char v2[] = anotherString.value;
int i = 0;
while (n– != 0) {
if (v1[i] != v2[i])
return false/;
i++;
}
return true;
}
}
return false;
}