-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItem.java
More file actions
28 lines (22 loc) · 615 Bytes
/
Copy pathItem.java
File metadata and controls
28 lines (22 loc) · 615 Bytes
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
package dome;
public class Item {
private String title; // 父类中private修饰的成员在子类中不可见
// protected 可以让子类和同父类一个包内其他类进行访问
private int playingTime;
private boolean gotIt = false;
public Item() {
}
public Item(String title, int playingTime, boolean gotIt) {
super();
this.title = title;
this.playingTime = playingTime;
this.gotIt = gotIt;
}
public void setTitle(String title) {
this.title = title;
}
public void print() {
// TODO Auto-generated method stub
System.out.print(title);
}
}