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 )

Name the containers which uses Border Layout as their default layout?

What are the services provided by a container?

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

Question: Explain the life-cycle methods in JSP?

Question: What is an Expression tag in JSP?

Types of Interviews

Getting started with Interview

Interview Question: What is the difference between JavaBean and EJB?

Interview Question: What is local interface. How values will be passed?

Interview Question: What is Message Driven Bean?

Interview Question: What is deployment descriptor?

Interview Question: How many EJB Objects are created for a Bean?

Interview Question: What is re-entrant. Is session beans reentrant. Is entity beans reentrant?

Interview Question: Is Decorator an EJB design pattern?

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

Latest Articles (in Interview)

Comment on this tutorial