package com.da;
//toString()方法,
//Object类重写。。。
public class ty {
private String name;
private int age;
private double high;
private String sex; public ty(String a, int b, double c, String d) {
name = a;
age = b;
high = c;
sex = d; } public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public int getAge() {
return age;
} public void setAge(int age) {
this.age = age;
} public double getHigh() {
return high;
} public void setHigh(double high) {
this.high = high;
} public String getSex() {
return sex;
} public void setSex(String sex) {
this.sex = sex;
} public String toString() { return "姓名:" + name + "年龄;" + age + "身高:" + high + "性别:" + sex;
} public boolean equals(Object o) {
if (((ty) o).name == this.name && ((ty) o).age == this.age) {
return true;
}
return false;
} public static void main(String[] args) {
ty d = new ty("啊", 3, 1.5, "男");
ty d1 = new ty("啊", 3, 1.1, "女");
System.out.println(d.toString());
System.out.println(d.equals(d1));
}
}

  

最新文章

  1. struts1和struts2的区别
  2. 洛谷10月月赛Round.3
  3. T-SQL 语句的理解
  4. JSon转化为DaTable
  5. linux包之procps之pmap命令
  6. C#网络通信
  7. [转]基于Spring + Spring MVC + Mybatis 高性能web构建
  8. POJ 2075 Tangled in Cables (c++/java)
  9. Nginx之RTMP
  10. SQL中内连接和外连接的问题!
  11. 理解TCP之Keepalive
  12. MVC 下 JsonResult 的使用方法(JsonRequestBehavior.AllowGet)
  13. HDU 3980 Paint Chain (sg函数)
  14. Knockout: 使用knockout validation插件进行校验, 给未通过校验的输入框添加红色边框突出显示.
  15. 56. Merge Intervals (Array; Sort)
  16. CocoaPods did not set the base configuration of your project 问题解决方式
  17. PLSQL Developer新手使用教程(图文教程)
  18. 转载:Candy? 在线性时间内求出素数与欧拉函数
  19. BZOJ4998 星球联盟(LCT+双连通分量+并查集)
  20. js Object.defineProperty 使用

热门文章

  1. mac 地址分配
  2. Python中为什么要使用线程池?如何使用线程池?
  3. rtpdataheader.h
  4. Crontab使用详解
  5. butterknif
  6. 模仿jquery框架源码 -生长---跨域访问
  7. jquery链式语法
  8. iOS 在视图控制器里面判断 应用程序的前台 后台切换 UIViewController
  9. [原创]java WEB学习笔记05:Servlet中的ServletConfig对象
  10. Referrer-Policy常见属性