How to define an Interface?

By: Karthik Printer Friendly Format    

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; 
} 




Most Viewed Articles (in Interview )

What are implicit Objects available to the JSP Page?

What types of comments are available in the JSP?

Interview Question: What about JSTL and JavaServer Faces ?

What is similarities/difference between an Abstract class and Interface?

Explain the new Features of JDBC 2.0 Core API?

Explain garbage collection?

Explain the Polymorphism principle.

Interview Question: How is the MVC design pattern used in Struts framework?

Interview Question: What is ActionForm?

Interview Question: What is ActionServlet?

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

Interview Question: Why does EJB needs two interfaces(Home and Remote Interface)?

Interview Question: What is the difference between EAR, JAR and WAR file?

Interview Question: What is abstract schema?

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

Latest Articles (in Interview)

Comment on this tutorial