Home » Interview Questions » Core Java Interview Questions » How to define an Interface?
 

How to define an Interface?

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;

}

 

 



Write a comment

  • Required fields are marked with *.

If you have trouble reading the code, click on the code itself to generate a new random code.
Security Code: