Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
71 lines (58 loc) · 1.31 KB

File metadata and controls

71 lines (58 loc) · 1.31 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.ddb.javacore.ood2;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Human implements Serializable, Comparable<Human> {
/**
*
*/
private static final long serialVersionUID = 1L;
private String id;
private String name;
private Integer age;
private String work;
public Human() {
// super();
System.out.println("这是Human 类的无参构造方法,作用创建Human类的一个实例对象");
}
public Human(String id, String name, Integer age, String work) {
// super();
this();
this.id = id;
this.name = name;
this.age = age;
this.work = work;
System.out.println("这是Human 类的4个参数构造方法,作用创建Human类的一个实例对象");
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Human [name=" + name + ", age=" + age + "]";
}
public Human(String id, String name) {
super();
this.id = id;
this.name = name;
}
@Override
public int compareTo(Human o) {
if (this.getAge().intValue() == o.getAge().intValue()) {
return 0;
} else if (this.getAge().intValue() > o.getAge().intValue()) {
return 1;
} else {
return -1;
}
}
public Human(String id, Integer age) {
super();
this.id = id;
this.age = age;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.