Introduction to Interactive Programming
by Lynn Andrea Stein
A Rethinking CS101 Project

Java Charts

Interface Declaration 7

public

Optional: 0 or 1.

If public, an interface name is universally visible for use as a type. Otherwise, the interface name is only visible within this package.

Note that the file in which a public interface InterfaceName is defined must have the name InterfaceName.java

interface InterfaceName

Exactly 1.

This name is a Java type that can be used anywhere it is visible. If the class is defined in a package other than the default, its proper name is packageName.InterfaceName, though this may be abbreviated using import statements.

extends OtherInterfaceName

Optional: 0 or 1.

If present, this interface extends the specification provided by OtherInterfaceName. Specifically, all methods and (static final) fields specified by InterfaceName are required for any instance implementing interface InterfaceName.

{ body }

Exactly 1, but body may be empty.

If not empty, body consists only of static final field declarations and nonstatic abstract method (signature) declarations.


© 1999 Lynn Andrea Stein

This chapter is excerpted from a draft ofIntroduction to Interactive Programming In Java, a forthcoming textbook from Morgan Kaufmann Publishers, Inc. It is a part of the course materials developed as a part of Lynn Andrea Stein's Rethinking CS101 project at the MIT AI Lab and the Department of Electrical Engineering and Computer Science at the Massachusetts Institute of Technology.

Questions or comments:
<[email protected]>

Last modified: Thu Jul 10 13:01:20 1997