Defining an Interface

Q

How to define an Interface?

✍: FYIcenter

A

Java Interface defines methods but does not implement them. Interface can include constants. A class that implements an interface is required to implement all the methods defined in the interface. Here is an example of interface definition:

public interface MyInterface {
   public string URL =
"http://interview.fyicenter.com";
   ...
   public void method();
   public void anotherMethod();
   ...
}

2007-03-03, 5257👍, 0💬