We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3499376 commit 225db03Copy full SHA for 225db03
20_Interfaces in java
@@ -0,0 +1,33 @@
1
+package com.company;
2
+
3
+interface Bicycle{
4
+ int a = 64;
5
+ void applyBrake(int decrement);
6
+ void speedUp(int increment);
7
+}
8
9
+ class AvonCycle implements Bicycle {
10
+ void blowHorn() {
11
+ System.out.println("Honk");
12
+ }
13
14
+ public void applyBrake(int decrement) {
15
+ System.out.println("Applying Brake");
16
17
18
+ public void speedUp(int increment) {
19
+ System.out.println("Increasing Speed");
20
21
22
+public class Interfaces {
23
+ public static void main(String[] args) {
24
+ AvonCycle cycle = new AvonCycle();
25
+ cycle.applyBrake(1);
26
+ cycle.blowHorn();
27
+ cycle.speedUp(3);
28
29
+ //cycle.a = 64; // You cannot modify the properties in Interface as they are final
30
31
+ System.out.println(cycle.a);
32
33
0 commit comments