Posts

Showing posts with the label java internals

Internals of Java Interface

Interface Internals in JAVA Little description of java internals about Interface : Some people say, Interface is used to implement the concept of Multiple Inheritance,but purpose of Interface is not implementing the concept of Multiple Inheritance in Java, although it looks like Multiple Inheritance. Apart from this It is very important to know that why do we need Interface? The answer is that, If we know about the entity, but don't know about the behavior then we need Interface. A very simple example of Interface is as follows- interface Animal  {    void eat ();   } class Goat implements Animal   {     Void eat ()       {          System.out.println ("Goat is eating grass");       }   } class Dog implements Animal   {        void eat ( )        {           System....