- <div class="blockcode"><blockquote><p class="blockcode"><blockquote>class Person {
- int temp;
- Person(int temp) {
- this.temp = temp;
- }
- public boolean equals(Object obj) {
- if (obj instanceof Person) {
- Person p = (Person) obj;
- }
- return false;
- }
- }
- public class Demo {
- public static void main(String[] args) {
- Person p1 = new Person(6);
- Person p2 = new Person(3);
- p1.equals(p2);
- }
- }
复制代码 |
|