Programming Tutorials

How to define an Interface?

By: Karthik in Interview Tutorials on 2012-06-16  

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





Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Interview )

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

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

Explain the user defined Exceptions?

How to define an Interface?

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

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

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

Interview Question: Is Decorator an EJB design pattern?

Interview Question: What are the call back methods in Entity bean?

Can Entity Beans have no create() methods?

Interview Question: What is abstract schema?

What is JAXP?

What are the services provided by a J2EE container?

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

What are types of J2EE clients?

Latest Articles (in Interview)