Introduction to OOP Chapter 4: Classes and Methods: next previous audio real text

Interfaces in Java

An interface is like a class, but it provides no implementation. Later, another class can declare that it supports the interface, and it must then give an implementation.

public interface Storing {
	void writeOut (Stream s);
	void readFrom (Stream s);
};

public class BitImage implements Storing {
	void writeOut (Stream s) {
		// ...
	}
	void readFrom (Stream s) {
		// ...
	}
};

We will have much more to say about interfaces later after we discuss inheritance.
Intro OOP, Chapter 4, Slide 28