-
Notifications
You must be signed in to change notification settings - Fork 0
/
Interfaces.java
62 lines (46 loc) · 882 Bytes
/
Interfaces.java
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
/*package whatever //do not write package name here */
import java.io.*;
//marker interface
interface in3{
int p = 5;
}
interface in1{
//public, static, final
int a = 1;
// public and abstract
default void show1(){
System.out.println(a);
}
}
interface in2 extends in1{
int b = 2;
// public and abstract
void show2();
//void show(int num);
}
class test implements in2{
/*
public void setA(int a){
this.a = a;
}
*/
/*
void show1(){
System.out.println(a);
}*/
public void show2(){
System.out.println(b);
}
/*
public void show(int num){
System.out.println(num);
}*/
}
class GFG {
public static void main (String[] args) {
test obj = new test();
//obj.setA(5);
obj.show1();
obj.show2();
}
}