Introduction : An interface is a reference type in Java. It is similar to class. It is a collection of abstract methods. A class implements an interface Brett Ritchie Stars Jersey , hence inheriting the abstract methods of the interface. With abstract methods , an interface contain constants, default methods Esa Lindell Stars Jersey , static methods, and nested types. An interface contains behaviors that a class implements. Unless the class that implements the interface is abstract, all the methods of the interface need to be defined in the class. How interface is similar to a class ? An interface is similar to a class in the following ways 鈭?br > 1) An interface can contain any number of methods. 2) An interface is written in a file with a .java extension Tyler Pitlick Stars Jersey , with the name of the interface matching the name of the file. java training center bangalore 3) The byte code of an interface appears in a .class file. 4) Interfaces appear in packages, and their corresponding bytecode file must be in a directory structure that matches the package name. How interface is different from the class ? An interface is different from a class in following ways 鈭?br > 1)We cannot create the object of an interface. 2)An interface does not contain any constructors. 3)All of the methods in an interface are by default abstract . 4)An interface cannot contain instance fields. The only fields that can appear in an interface must be declared both static and final. java course in bangalore 5)An interface is not extended by a class; it is implemented by a class. 6)An interface can extend multiple interfaces. Declaration of Interface : The interface keyword is used to declare an interface. Implementing Interfaces : When a class implements an interface, all methods of the interface should be implemented by the class . Otherwise declare the class as abstract .A class uses the implements keyword to implement an interface. Extending Interfaces : An interface can extend another interface in the same way that a class can extend another class. The extends keyword is used to extend an interface Devin Shore Stars Jersey , and the child interface inherits the methods of the parent interface. advanced java training in bangalore Extending Multiple Interfaces : A Java class can only extend one parent class. Multiple inheritance is not allowed using class . Interfaces are not classes, however, and an interface can extend more than one parent interface. So multiple inheritance is possible using interface . The extends keyword is used once Blake Comeau Stars Jersey , and the parent interfaces are declared in a comma-separated list. Tagging Interfaces : The most common use of extending interfaces occurs when the parent interface does not contain any methods. An interface with no methods is known as a tagging interface. There are two reason for tagging interfaces 鈥?best core java training in bangalore Creates a common parent 鈭?As with the EventListener interface, which is extended by dozens of other interfaces in the Java API, we can use a tagging interface to create a common parent among a group of interfaces. For example Mattias Janmark Stars Jersey , when an interface extends EventListener, the JVM knows that this particular interface is going to be used in an event delegation scenario. Adds a data type to a class 鈭?This situation is where the term, tagging comes from. A class that implements a tagging interface does not need to define any methods (since the interface does not have any) Radek Faksa Stars Jersey , but the class becomes an interface type through polymorphism. Javaj2ee classes bangalore Why we use interface ? Interface is mainly used for abstraction. Since methods in interfaces do not have body, they have to be implemented by the class before we can access them. The class that implements interface must implement all the methods of that interface. Also, java programming language does not support multiple inheritance using class John Klingberg Stars Jersey , using interfaces we can achieve this . Some important points for interface : rface is the keyword that is used to create an interface in java. can鈥檛 create object for an interface in java. rface contains only abstract methods. Java training center bangalore rfaces can鈥檛 have constructors default any attribute of interface is public, static and final interface can鈥檛 extend any class but it can extend another interface.. ements keyword is used by classes to implement an interface. 8.A class implementing an interface must provide implementation for all of its method unless it鈥檚 an abstract class. This is the short description about the interface . To get the good knowledge on java for getting a job as java developer attend java training in Infocampus Software Training Institute . Author : Infocampus is the best java training center bangalore . It provides java course with the 100% placement assistance and live project .Free demo classes are available for javaj2ee classes . For best core java training complete practical classes are provided by the infocampus . Every weekend demo classes are available for advanced java training . In java training syllabus is according to getting a job easily . To book the seat for free demo class on java training call at : 9738001024 or to get the syllabus of java course enquire at : Total Views: 147Word Count: 831See All articles From Author Use the tools to enhance the rank Posted On : Feb-02-2010 | seen (227) times | . Cheap JerseysWholesale Soccer JerseysWholesale MLB Jerseys ChinaWholesale NHL Jerseys Free ShippingWholesale Authentic NFL JerseysCheap JerseysCheap Jerseys From ChinaCheap College Football JerseysCheap Jerseys From ChinaWholesale NCAA Jerseys