-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInterfaceEx.java
73 lines (64 loc) · 1.51 KB
/
InterfaceEx.java
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package kr.ac.kookmin.cs.opp.ch5;
interface phoneinterface {
final int TIMEOUT = 10000;
void sendCall();
void receivecall();
default void printLogo() {
System.out.println("**Phone**");
}
}// 추상클래스는 맴버변수 가질수있다. 필드값
interface MobilePhoneInterface extends phoneinterface {
void sendSMS();
void receiveSMS();
}
interface MP3interface {
public void play();
public void stop();
}
class PDA {
public int calculate(int x, int y) {
return x+y;
}
}
class SmartPhone extends PDA implements MobilePhoneInterface, MP3interface {
@Override
public void sendCall() {
System.out.println("띠리리리링");
}
@Override
public void receivecall() {
System.out.println("전화가 왔습니다.");
}
public void flash( ) {System.out.println("전화기에 불이 켜졌습니다"); }
@Override
public void play() {
System.out.println("음악 연주합니다.");
}
@Override
public void stop() {
System.out.println("음악 중단합니다.");
}
@Override
public void sendSMS() {
System.out.println("문자갑니다.");
}
@Override
public void receiveSMS() {
System.out.println("문자왔어요");
}
public void schedule() {
System.out.println("일정 관리합니다.");
}
}
public class InterfaceEx {
public static void main(String[] args) {
SmartPhone phone = new SmartPhone();
phone.printLogo();
phone.sendCall();
phone.play();
System.out.println("3 + 5 = " + phone.calculate(3,5));
phone.receivecall();
phone.schedule();
phone.flash();
}
}