CMSC 132A Lecture Notes - Lecture 8: Semicolon
Document Summary
An interface declaration consists of modifiers, the keyword interface, the interface name, a comma-separated list of parent interfaces (if any), and the interface body. For example: public interface groupedinterface extends interface1, interface2, interface3 { // base of natural logarithms double e = 2. 718282; // method signatures void dosomething (int i, double x); int dosomethingelse(string s); The public access specifier indicates that the interface can be used by any class in any package. If you do not specify that the interface is public, then your interface is accessible only to classes defined in the same package as the interface. An interface can extend other interfaces, just as a class subclass or extend another class. However, whereas a class can extend only one other class, an interface can extend any number of interfaces. The interface declaration includes a comma-separated list of all the interfaces that it extends. The interface body can contain abstract methods, default methods, and static methods.