A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 李能甫 中级黑马   /  2015-3-31 22:12  /  296 人查看  /  3 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

  1. package javaAdvanced;

  2. /**
  3. * 类的描述信息
  4. * 反射信息的测试类
  5. *
  6. * @author cuiH
  7. * Date: 13-12-2
  8. */
  9. public class ReflectPoint {
  10.     private int x;
  11.     public int y;

  12.     public String str1 = "football";
  13.     public String str2 = "basketball";
  14.     public String str3 = "pingPang";

  15.     public ReflectPoint(int x, int y) {
  16.         this.x = x;
  17.         this.y = y;
  18.     }

  19.     @Override
  20.     public String toString() {
  21.         return super.toString();
  22.     }

  23.     @Override
  24.     public boolean equals(Object o) {
  25.         if (this == o) return true;
  26.         if (!(o instanceof ReflectPoint)) return false;

  27.         ReflectPoint that = (ReflectPoint) o;

  28.         if (x != that.x) return false;
  29.         if (y != that.y) return false;

  30.         return true;
  31.     }

  32.     @Override
  33.     public int hashCode() {
  34.         int result = x;
  35.         result = 31 * result + y;
  36.         return result;
  37.     }
  38. }
复制代码

3 个回复

倒序浏览
你发这代码是有什么意图?
回复 使用道具 举报
非常好!!!赞一个 。
回复 使用道具 举报
lwj123 发表于 2015-3-31 22:55
你发这代码是有什么意图?

仅供学习交流,哪有什么意图呢?
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马