-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathNullTicket.java
More file actions
45 lines (39 loc) · 867 Bytes
/
NullTicket.java
File metadata and controls
45 lines (39 loc) · 867 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package nullobject;
/**
* @author 1851594王思桐
*/
public class NullTicket implements Ticket{
/**
* show Info of the NullTicket
* @return info:String, information of the instance
*/
@Override
public String getInfo() {
return "NullTicket:("+this.hashCode()+"):getInfo():"+"Invalid Ticket!";
}
/**
* return null when calling this method
* @return null
*/
@Override
public String getID() {
return null;
}
/**
* return null when calling this method
* @return null
*/
@Override
public String getCustomerID() {
return null;
}
@Override
public boolean isNull() {
return true;
}
@Override
public void buy() {
System.out.println("("+this.toString()+") : ");
System.out.println("Wrong message!");
}
}