-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractInterfaceDemo.java
More file actions
39 lines (33 loc) · 1.09 KB
/
AbstractInterfaceDemo.java
File metadata and controls
39 lines (33 loc) · 1.09 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
import static java.lang.System.out;
interface CommonActivities {
void move();
}
interface childInterface extends CommonActivities {
void run();
}
abstract class SomeCommonActivities {
abstract void fly();
void talk() {
out.println("talking");
}
}
abstract class childAbstract implements CommonActivities {
void swim() {
out.println("its swimming");
}
}
class AbstractInterfaceDemo imple
ments childInterface{
public void move() {
out.println("move method from interface commonActivities");
}
public void run() {
out.println("run method from Child interface which extends interface commonActivities");
}
public static void main(String[] args) {
AbstractInterfaceDemo obj = new AbstractInterfaceDemo();
obj.move();
obj.run();
}
}
// All methods in interface are implicitly public. But inside a class if public is not mentioned explicitly, it has only package visibility. Through overriding, you can only increase visibility. You cannot decrease visibility.