Posts

Showing posts with the label Interface

Interface in java

The interface keyword is used to declare an interface. An interface  is a blueprint of a class. We can't create an instance of interface . By using interface , we  can achieve abstraction in java  By using interface , we can implement the functionality of multiple inheritance. It does not contain any constructor. All the methods are abstract method in interface. An interface can't be extends by a class but extends by interface . An interface can't be implemented by interface but implemented by a class. Example :   interface   Car{             float getAmount();        }   class Audi implements Car{            public float getAmount(){return 2.5f;}       }   class Bmw implements Car{         public float getAmount(){return 80.3f;} ...