forked from kajal200031/basic-python
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInterfaceInheritance.java
More file actions
Latest commit
35 lines (30 loc) · 554 Bytes
/
Copy pathInterfaceInheritance.java
File metadata and controls
35 lines (30 loc) · 554 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
//interface inheritance
interfacePrintable
{
voidprint();
}
interfaceDrawableextendsPrintable
{
//as drawable is child of printable so print() is inherited in drawable from printable
voiddraw();
}
classSquareimplementsDrawable//both print() and draw() will be overriden in square class
{
publicvoidprint()
{
System.out.println("Print Square");
}
publicvoiddraw()
{
System.out.println("Draw Square");
}
}
classDemo
{
publicstaticvoidmain(String...a)
{
Squares=newSquare();
s.print();
s.draw();
}
}