Video 55

Yash
0

 


Program:-

interface Bicycle{
    int a = 45;
    void applyBrake(int decrement);
    void speedup(int increment);
}

interface HornBicycle{
    int x =45;
    void blowHornK3g();
    void blowHornmhn();
}

class AvonCycle implements Bicycle, HornBicycle{
    void blowHorn(){
        System.out.println("Pee Pee Poo Poo");
    }
    public void applyBrake(int decrement){
        System.out.println("Apply brake");
    }
    public void speedup(int increment){
        System.out.println("Applying SpeedUp");
    }
    public void blowHornK3g(){
        System.out.println("kabhi khushi kabhi gum pee pee pee pee");
    }
    public void blowHornmhn(){
        System.out.println("Main hoon na poo poo poo poo");
    }
}

public class Interface_V55 {
    public static void main(String[] args) {
        AvonCycle a = new AvonCycle();
        a.applyBrake(1);
        a.speedup(1);
        // You can create properties in Interfaces
        System.out.println(a.a);
        System.out.println(a.x);

        //you cannot modify the properties in interfaces as they are final
        //a.a = 45;
        //System.out.println(a.a);
        a.blowHornK3g();
        a.blowHornmhn();
    }
}

Post a Comment

0 Comments
Post a Comment (0)
To Top