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 )

Interview Question: Where can I get a copy of Struts?

Interview Question: Where can I get help with Struts?

Interview Question: Why aren't the Struts tags maintained as part of the Jakarta Taglibs project ?

Interview Question: Is there a particularly good IDE to use with Struts ?

Interview Question: What is Remote client view?

Interview Question: Can I invoke Runtime.gc() in an EJB?

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

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

Interview Question: What is lazy loading?

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

What do you understand by a J2EE module?

What is Deployment Descriptor?

What do you understand by JTA and JTS?

Explain the Polymorphism principle.

What do you understand by JSP Actions?

Latest Articles (in Interview)

Comment on this tutorial