The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Trail: Learning the Java Language
Lesson: Interfaces and Packages

Using an Interface as a Type

When you define a new interface, you are in essence defining a new reference data type. You can use interface names anywhere you can use any other data type name.

For example, the AlarmClock class uses the Sleeper type in two places:


Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form