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...
Packages In Java: Package is a container for the classes that are used to keep the class name space compartmentalized. In other words, Java Packages are nothing more thanthe way we organize files into different directories according to their functionality, usability as well as category they should belong to. A Java package is a Java programming language mechanism for orgranizing classes into name spaces. Example: You can contain all classses related to all sorting programs in your own package. We can keep different classes of same type in a same package for better glance of the project. It allows fexibility to give same name but to many classes, that is to avoid name space collision . The packages in Java provides mechanism for partitioning the class name space into more manageable chunks. Infact, package is both a naming and a visibillity control mechanism. It supports reusability and maintainability of the Java codes. Advantages of Packages: Packages prov...