-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathChap12_ExerciseQ8.java
More file actions
53 lines (44 loc) Β· 980 Bytes
/
Chap12_ExerciseQ8.java
File metadata and controls
53 lines (44 loc) Β· 980 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
46
47
48
49
50
51
52
53
/*
HWJava18_09_Chap12Summary_λ°°μ¬μ°.zip
μ°μ΅λ¬Έμ
Q8. λ€μ μΈν°νμ΄μ€ Aλ λν΄νΈ λ©μλλ₯Ό ν¬ν¨νκ³ μλ€.
μμ ν΄λμ€μμ λΆλͺ¨ ν΄λμ€μ abc() λ©μλλ₯Ό νΈμΆνλ μ½λλ₯Ό μΆκ°ν΄ λ€μκ³Ό κ°μ μ€ν κ²°κ³Όκ° λμ€λλ‘ λΉμΉΈμ μμ±νμμ€.
interface A {
default void abc() {
System.out.println("A μΈν°νμ΄μ€μ abc()");
}
}
class B implements A {
@Override
public void abc() {
__________
__________
System.out.println("B ν΄λμ€μ abc()");
}
}
B b = new B();
b.abc();
==========
μ€ν κ²°κ³Ό
A μΈν°νμ΄μ€μ abc()
B ν΄λμ€μ abc()
*/
package classes;
interface A {
default void abc() {
System.out.println("A μΈν°νμ΄μ€μ abc()");
}
}
class B implements A {
@Override
public void abc() {
A.super.abc();
System.out.println("B ν΄λμ€μ abc()");
}
}
public class Chap12_ExerciseQ8 {
public static void main(String[] args) {
B b = new B();
b.abc();
}
}