-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterf.java
More file actions
70 lines (50 loc) · 1.08 KB
/
Copy pathinterf.java
File metadata and controls
70 lines (50 loc) · 1.08 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
60
61
62
63
64
65
66
67
68
69
70
interface A
{
// varirables in interface - final and static variables
int age = 20;
String name = "Ayaan";
//methods in interface - public abstract type pre-defined
void show();
void conf();
}
interface X
{
void run();
}
interface Y extends X
{
void stop();
}
class B implements A,Y
{
public void show() {
System.out.println("show method");
}
public void conf() {
System.out.println("conf method");
}
public void run() {
System.out.println("run method");
}
public void stop() {
System.out.println("stop method");
}
}
public class interf {
public static void main(String[] args) {
A obj;
System.out.println(A.name);
System.out.println(A.age);
// cant create object of interface A
//obj = new A();
obj = new B();
obj.show();
obj.conf();
// cant call stop from A type obj
//obj.stop();
System.out.println();
Y obj2 = new B();
obj2.run();
obj2.stop();
}
}