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
46 lines (33 loc) · 1.03 KB

File metadata and controls

46 lines (33 loc) · 1.03 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
package com.ddb.javacore.ood2;
public class Worker extends Human {
private String country;
public Worker() {
super();
}
public Worker(String id, String name, Integer age, String work) {
super();
System.out.println("这是Worker的无参构造方法,用来创建Worker类的一个实例对象!");
}
public Worker(String id, String name, Integer age, String work, String country) {
super(id, name, age, work);
this.country = country;
System.out.println("这是Worker的country的参数构造方法,用来创建Worker类的一个实例对象!");
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public void work() {
System.out.println("我是工人,我会搬砖!");
}
@Override
public String toString() {
return super.toString() + "----Worker [country=" + country + "]";
}
public static void main(String[] args) {
Worker worker = new Worker("ID-123456", "zhangsan", 36, "Worker", "China");
System.out.println(worker);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.