We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b05ca18 commit 05cd527Copy full SHA for 05cd527
1 file changed
Abstract and Interface/InterfaceDemo.java
@@ -0,0 +1,29 @@
1
+interface InterfaceDemo
2
+{
3
+ // abstract method
4
+ public void square();
5
+
6
+ // default method
7
+ default void show()
8
+ {
9
+ System.out.println("This is a defult method");
10
+ }
11
+}
12
13
+class TestClass implements InterfaceDemo
14
15
+ // implementation of square abstract method
16
+ public void square(int a)
17
18
+ System.out.println(a*a);
19
20
21
+ public static void main(String args[])
22
23
+ TestClass d = new TestClass();
24
+ d.square(4);
25
26
+ // default method executed
27
+ d.show();
28
29
0 commit comments