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 all the different scope values for the tag?

Interview Question: What is ActionServlet?

Interview Question: What is difference between EJB 1.1 and EJB 2.0?

Interview Question: What is the difference between sessioncontext and entitycontext?

Interview Question: Is Decorator an EJB design pattern?

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

Interview Question: What is abstract schema?

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

Interview Question: Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?

Question: Difference between forward and sendRedirect in JSP?

Question: What is an Expression tag in JSP?

Question: Explain the life-cycle methods in JSP?

Question: What is the directory structure of a web application?

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

Question: How would you go about analyzing performance of an application?

Latest Articles (in Interview)

Comment on this tutorial