-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterfaceInhertence.java
More file actions
63 lines (48 loc) · 1006 Bytes
/
Copy pathInterfaceInhertence.java
File metadata and controls
63 lines (48 loc) · 1006 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
54
55
56
57
58
59
60
61
62
63
package test;
/* Interface is nothing but a block of code where we can do function declaration
* */
interface I2
{
void f1();//only function declaration
}
interface I3
{
void f2();
}
interface I4 extends I2,I3
{
/* 1. Interface can have multiple inheritance
* 2. This I4 interface can access all of its parent interface
* */
void f3();
}
class All implements I4//attach interface with class
{
/* 1. We have to make all function over riding, which can be accessed by I4
* 2. We must have to use "public" access specifier for that over riding function.
* Otherwise it will give an error.
* 3. We can't create object of interface, but we can create its reference.
* */
public void f1()
{
System.out.println("F1");
}
public void f2()
{
System.out.println("F2");
}
public void f3()
{
System.out.println("F3");
}
}
public class InterfaceInhertence
{
public static void main(String[] args)
{
All ob1 = new All();
ob1.f1();
ob1.f2();
ob1.f3();
}
}