View Nirupama  Pathak 's Profile
How to define an Interface in Java ?
In Java Interface defines the methods but does not implement them. Interface can include constants. A class that implements the interfaces is bound to implement all the methods defined in Interface.
Emaple of Interface:

public interface sampleInterface {
public void functionOne();

public long CONSTANT_ONE = 1000;
}
Asked by Nirupama Pathak | Aug 13 2018 | Report this Report abuse
Replies (9)
View Roshan  shah 's Profile
Is Iterator a Class or Interface? What is its use?
Aug 18 2018 | Report this Report abuse
View Shivendu  Chatterjee 's Profile
Unless the class that executes the interface is conceptual, every one of the techniques for the interface should be characterized in the class. An interface can contain any number of strategies. An interface is composed in a record with a .java expansion, with the name of the interface coordinating the name of the document.
Aug 17 2018 | Report this Report abuse
View Shivendu  Chatterjee 's Profile
Unless the class that executes the interface is conceptual, every one of the techniques for the interface should be characterized in the class. An interface can contain any number of strategies. An interface is composed in a record with a .java expansion, with the name of the interface coordinating the name of the document.
Aug 17 2018 | Report this Report abuse
View Shatish  Rao 's Profile
The interface in java is a mechanism to achieve abstraction. There can be only abstract methods in the java interface not method body. It is used to achieve abstraction and multiple inheritance in Java. It cannot be instantiated just like abstract class.
http://www.cetpainfotech.com/technology/java-training
Aug 17 2018 | Report this Report abuse
View Diksha  Basu 's Profile
The interface in java is a mechanism to achieve abstraction. There can be only abstract methods in the java interface not method body. It is used to achieve abstraction and multiple inheritance in Java. It cannot be instantiated just like abstract class.
http://www.cetpainfotech.com/technology/java-training
Aug 17 2018 | Report this Report abuse
View Chinmay  Hegde 's Profile
An interface is a reference type in Java, it is similar to category, it is a collection of subjective techniques. A category implements an interface, thereby inheriting the subjective types of the interface.
Along with subjective techniques an interface may also contain constants, default techniques, static techniques, and nested types. Method bodies exist only for default techniques and static techniques.
Writing an interface is similar to writing a category. But a category describes the attributes and behaviours of an object. And an interface contains behaviours that a category implements.
Unless the course that implements the interface is subjective, all the types of the interface need to be defined in the course.
An interface is similar to a category in the following ways:
An interface can contain any number of techniques.
An interface is written in data with a java extension, with the name of the interface matching the name of the computer file.
The byte code of an interface appears in a class computer file.
Interfaces appear in packages, and their corresponding bytecode computer file must be in a directory structure that matches the package name.
However, an interface is different from a category in several ways, including:
You cannot instantiate an interface.
An interface does not contain any constructors
All of particularly in an interface are subjective
An interface cannot contain instance fields. The only fields that can appear in an interface must be declared both static and final
An interface is not extended by a class it is implemented by a category.
An interface can extend multiple interfaces
Announcing Interfaces
The interface keyword and key phrase is used to announce an interface. Here is a simple example to announce an interface:
Interfaces have the following properties:
1. An interface is unquestioningly subjective. You do not need to use the subjective keyword and key phrase while declaring an interface.
2. Each method in an interface is also unquestioningly subjective, so the subjective keyword and key phrase is not needed.
3. Methods in an interface are unquestioningly public.

Implementing Interfaces
When a category implements an interface, you can think of the course as signing a contract, agreeing to perform the specific actions of the interface. If a category does not perform all the actions of the interface, the course must declare itself as abstract.
A category uses the implements keyword to implement an interface.
Aug 16 2018 | Report this Report abuse
View Tanya  Sharma 's Profile
An interface is a reference type in Java, it is similar to category, it is a collection of subjective techniques. A category implements an interface, thereby inheriting the subjective types of the interface.
Along with subjective techniques an interface may also contain constants, default techniques, static techniques, and nested types. Method bodies exist only for default techniques and static techniques.
Writing an interface is similar to writing a category. But a category describes the attributes and behaviours of an object. And an interface contains behaviours that a category implements.
Unless the course that implements the interface is subjective, all the types of the interface need to be defined in the course.
An interface is similar to a category in the following ways:
An interface can contain any number of techniques.
An interface is written in data with a java extension, with the name of the interface matching the name of the computer file.
The byte code of an interface appears in a class computer file.
Interfaces appear in packages, and their corresponding bytecode computer file must be in a directory structure that matches the package name.
However, an interface is different from a category in several ways, including:
You cannot instantiate an interface.
An interface does not contain any constructors
All of particularly in an interface are subjective
An interface cannot contain instance fields. The only fields that can appear in an interface must be declared both static and final
An interface is not extended by a class it is implemented by a category.
An interface can extend multiple interfaces
Announcing Interfaces
The interface keyword and key phrase is used to announce an interface. Here is a simple example to announce an interface:
Interfaces have the following properties:
1. An interface is unquestioningly subjective. You do not need to use the subjective keyword and key phrase while declaring an interface.
2. Each method in an interface is also unquestioningly subjective, so the subjective keyword and key phrase is not needed.
3. Methods in an interface are unquestioningly public.

Implementing Interfaces
When a category implements an interface, you can think of the course as signing a contract, agreeing to perform the specific actions of the interface. If a category does not perform all the actions of the interface, the course must declare itself as abstract.
A category uses the implements keyword to implement an interface.
Aug 16 2018 | Report this Report abuse
View Khushi   Kumari 's Profile
As mentioned above they are used for abstraction. Since methods in interfaces do not have body, they have to be implemented by the class before you 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 interfaces we can achieve this as a class can implement more than one interfaces, however it cannot extend more than one classes.

To Know More Visit the :-http://www.cetpainfotech.com/technology/java-training
Aug 16 2018 | Report this Report abuse
View Khushi   Kumari 's Profile
As mentioned above they are used for abstraction. Since methods in interfaces do not have body, they have to be implemented by the class before you 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 interfaces we can achieve this as a class can implement more than one interfaces, however it cannot extend more than one classes.

To Know More Visit the :-http://www.cetpainfotech.com/technology/java-training
Aug 16 2018 | Report this Report abuse