-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTestInterface.java
More file actions
35 lines (29 loc) · 884 Bytes
/
Copy pathTestInterface.java
File metadata and controls
35 lines (29 loc) · 884 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 Bycycle{
int a= 45 ;
void pedal();
void brake();
}
interface blowhorn{ //we can user more than one interface but incase of abstract it is not applicable
void blowhorn();
}
class Avon implements Bycycle , blowhorn{
public void pedal(){
System.out.println("Avon pedaling");
}
public void brake(){
System.out.println("Avon braking");
}
public void blowhorn(){
System.out.println("pe peepp pee peeee");
}
}
public class TestInterface {
public static void main(String[] args) {
Avon cycle = new Avon();
cycle.pedal(); //we can create properties in interface
System.out.println("You are pedalling");
cycle.brake();
System.out.println(cycle.a); //We can't modify the properties in interface as they are final
cycle.blowhorn();
}
}