How to define an Interface?

By: Karthik  

Answer: 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.

Example of Interface:

public interface sampleInterface {
    public void functionOne();
    public long CONSTANT_ONE = 1000; 
} 



Archived Comments


Most Viewed Articles (in Interview )

What are implicit Objects available to the JSP Page?

Interview Question: What about JSTL and JavaServer Faces ?

Interview Question: Why are some of the class and element names counter-intuitive?

Interview Question: What is lazy loading?

Interview Question: What is the difference between find and select methods in EJB?

Interview Question: Do you have to credit Struts on your own website?

Interview Question: What is the difference between Message Driven Beans and Stateless Session beans?

Is Iterator a Class or Interface? What is its use?

Interview Question: Can i map more than one table in a CMP?

What is JSP declaration?

Question: What is an Expression tag in JSP?

What is JAXP?

What are the call back methods in Session bean?

Can Entity Beans have no create() methods?

What do you understand by JTA and JTS?

Latest Articles (in Interview)

Comment on this tutorial