- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChapter32.java
More file actions
Latest commit
59 lines (47 loc) · 1.48 KB
/
Copy pathChapter32.java
File metadata and controls
59 lines (47 loc) · 1.48 KB
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
packagechapter32;
interfacePrinter{
publicstaticfinalintINK = 100;//상수
publicabstractvoidprint();//추상 메서드
}
interfaceScanner{
publicabstractvoidscan();//추상 메서드
}
interfaceFax{
publicstaticfinalStringFAX_NUMBER = "02-1234-5678";//상수
publicabstractvoidsend(Stringtel);//추상 메서드
publicabstractvoidreceive(Stringtel);//추상 메서드
}
//구현 클래스 설정
classComplxerimplementsPrinter,Scanner,Fax{
@Override
publicvoidsend(Stringtel) {
System.out.println(FAX_NUMBER+"에서"+tel+"로 FAX 전송");
}
@Override
publicvoidreceive(Stringtel) {
System.out.println(tel+"에서"+FAX_NUMBER+"로 FAX 전송");
}
@Override
publicvoidscan() {
System.out.println("스캔 실행");
}
@Override
publicvoidprint() {
System.out.println("출력 실행");
}
}
publicclassComplewMain {
publicstaticvoidmain(String[] args) {
Complxercom = newComplxer();
com.print();
com.scan();
com.send("02-8675-4321");
com.receive("02-8675-4321");
System.out.println("com.FAX_NUMBER = "+com.FAX_NUMBER);
System.out.println("com.INK = "+com.INK);
System.out.println("Complxer.FAX_NUMBER = "+Complxer.FAX_NUMBER);
System.out.println("Complxer.INK = "+Complxer.INK);
System.out.println(Fax.FAX_NUMBER);
System.out.println(Printer.INK);
}
}