/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Aluno {
private float rg;
private int idade;
public Aluno
(String nome,
float rg,
int idade
) { this.nome = nome;
this.rg = rg;
this.idade = idade;
}
@Override
public boolean equals
(Object o
) { boolean result = false;
if (this.getRg() == ((Aluno)o).getRg()) {
result = true;
}
return result;
}
public float getRg() {
return this.rg;
}
}
class Ideone
{
public static void main
(String[] args
) {
Aluno a1 = new Aluno("A", 12, 20);
Aluno a2 = new Aluno("B", 11, 25);
Aluno a3 = new Aluno("A", 25, 28);
Aluno a4 = new Aluno("D", 12, 21);
System.
out.
println(a1.
equals(a3
)); // aqui retorna false System.
out.
println(a1.
equals(a4
)); // aqui retorna true }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KCmNsYXNzIEFsdW5vIHsKICAgcHJpdmF0ZSBTdHJpbmcgbm9tZTsKICAgcHJpdmF0ZSBmbG9hdCByZzsKICAgcHJpdmF0ZSBpbnQgaWRhZGU7CgogICBwdWJsaWMgQWx1bm8oU3RyaW5nIG5vbWUsIGZsb2F0IHJnLCBpbnQgaWRhZGUpIHsKICAgICAgdGhpcy5ub21lID0gbm9tZTsKICAgICAgdGhpcy5yZyA9IHJnOwogICAgICB0aGlzLmlkYWRlID0gaWRhZGU7CiAgIH0KCiAgIEBPdmVycmlkZQogICBwdWJsaWMgYm9vbGVhbiBlcXVhbHMoT2JqZWN0IG8pIHsKICAgICAgYm9vbGVhbiByZXN1bHQgPSBmYWxzZTsKICAgICAgaWYgKHRoaXMuZ2V0UmcoKSA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