HELP! * GREY=local LOCAL HTML version of Foils prepared July 10 1996
Foil 87 Interfaces can be used as Classes in type specification
From Basic Lectures on Java Language Applets Graphics Networking Trip to China and Icase Tutorial -- July 12-28 and June 10-13 96. byGeoffrey C. Fox * Important Information in IMAGE
Interfaces behave exactly as classes when used as a type.
The syntax interfaceName variableName declares a variable or parameter to be an instance of some class that implements interfaceName.
public class StudentBody {
Stream s;
Picture id_photo;
StudentRecord id_card;
...
public void register() {
save(id_photo);
save(id_card);
}
public void save(Storable o) {
o.store(s);
}
}
Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.