-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathProblemWithInterface.java
More file actions
47 lines (41 loc) · 907 Bytes
/
ProblemWithInterface.java
File metadata and controls
47 lines (41 loc) · 907 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
import java.awt.event.WindowAdapter;
import java.awt.event.WindowListener;
interface P
{
void show();
void print();
void add();
}
// We Need to define all the methods in the class
// Prior to Java 8 We Need to implement 100% Methods of interface in class
// Adapter it is a Design Pattern
abstract class PAdapter implements P{
public void commonLogic(){
System.out.println("This is Common Logic ");
}
@Override
public void show(){}
@Override
public void print(){}
@Override
public void add(){}
}
class P1 extends PAdapter{//implements P{
@Override
public void show(){
System.out.println("This is My P1 Show");
}
}
class P2 extends PAdapter{
@Override
public void print(){
System.out.println("This is P2 Print");
}
}
public class ProblemWithInterface {
public static void main(String[] args) {
WindowListener w;
WindowAdapter w1;
// TODO Auto-generated method stub
}
}