forked from echoTheLiar/JavaCodeAcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReciever.java
More file actions
36 lines (28 loc) · 669 Bytes
/
Reciever.java
File metadata and controls
36 lines (28 loc) · 669 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
package designpattern.command;
/**
* 知道如何实施与执行一个与请求相关的操作,任何类都可能作为一个接收者。真正执行请求的地方!
*
* @author liu yuning
*
*/
interface Reciever {
public void action();
}
class RecieverA implements Reciever {
@Override
public void action() {
System.out.println("RecieverA执行请求!");
}
}
class RecieverB implements Reciever {
@Override
public void action() {
System.out.println("RecieverB执行请求!");
}
}
class RecieverC implements Reciever {
@Override
public void action() {
System.out.println("RecieverC执行请求!");
}
}