What Is An Interface? Or Define Interface.java

2

2 Answers

ghazal gi Profile
ghazal gi answered
Interface term in general sense, is used for the association between the peripherals and the computer; the peripherals can be the devises like cd drive, scanner, hard drive and printer.

If we talk in the context of java programming language then, interface is a program or a method which have its own features which the classes use later on.
The classes implement the interfaces with the help of "interface" keyword.
Interfaces are not immediately created or instantiated because these are abstract.
To implement an interface in our class the "implement" keyword is used, for example (implement interface.).

All the procedures and methods in the interface must be implemented in the class, if a class implements an interface, otherwise, if the class don't implement all methods then it will be an abstract class.Interfaces are accustomed to gather alike resemblance, which classes of diverse kind share, but don't essentially comprise a class association.

There is also the good feature of interface that, there is no need to know the class type of an object for using that object, we just implement the interface of our choice.
Interfaces are very good and nice feature of java programming, which give the facility of using predefined functions as a whole.
Ramesh Kumar Profile
Ramesh Kumar answered
Interface contains only method names it doesn't contains the body of the methods.It should be implemented by other class .The other classes who implements the interface should be defined all the methods.Any one can create any number of classes implementing the interface. We can not create object to the interface but we can create reference for the interface.

Answer Question

Anonymous