-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewPlay
49 lines (45 loc) · 867 Bytes
/
newPlay
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
package newPlay;
/**
* 实现抽象类和接口
* 继承抽象类的子类必须实现抽象类的抽象函数
*/
/**
* 接口
*/
interface player{
int flag = 1;
void play();
void pause();
void stop();
}
/**
* 抽象类
*/
abstract class playing{
public void show(Object o)
{
System.out.println(o.toString());
}
abstract void winRun();
}
public class newPlay extends playing implements player{
public void play(){
show("newPlay.play()");
}
public void pause(){
show("newPlay.pause()");
}
public void stop(){
show("newPlay.stop()");
}
public void winRun(){
show("newPlay.winRun()");
}
public static void main(String[] args) {
newPlay nP = new newPlay();
nP.play();
nP.pause();
nP.stop();
nP.winRun();
}
}