In java there is another way for achieve Abstraction , That is using Interface. What is Interface in Java? Interface is like java class, but interface has only abstract method and static constants. Interface is used for implement multiple inheritance. multiple inheritance is not supported in java. In simple word Interface is used to achieve multiple inheritance and abstraction. Learn more about Abstraction. All method in interface are public and abstract. Interface only contains abstract method means method does not contain its body. A java class can implement multiple interface. Syntax of Interface Interface interface_name { // Constants variables. // Method declaration without body. } Like abstraction, Interface also does not have method body. But interface contains method declaration, Default, Constants and Static methods. Interface is implements by class and then class provides implementation of abstract methods. Interface can also extends another interface like class
Welcome To Programming Tutorial. Here i share about Java Programming stuff. I share Java stuff with simple examples.