Skip to main content

Posts

Showing posts from March, 2019

Interface in Java

Introduction: Prerequisites: Abstraction in Java Inheritance in Java Multiple inheritance is a process in which a class inherits two other parent class, taking the benefits of the two classes. However, Java doesn't support multiple inheritance. Multiple inheritance sometimes creates problems for the programmers to understand the codes and inheritance procedure. So, Java's solution to this problem is called interface. Interface in Java is nothing but a collection to method declaration. Interface is basically a kind of class. Like classes, an interface contains members and method, unlike classes, in interface all members are final and all methods are abstract. However an interface can contain non- abstract method. Interface Concept: An interface defines a protocol of behavior that can be implemented by any class anywhere in the class hierarchy. That is, the interface is a collection of behaviors that can be implemented by any class in any...