Basic HTML version of Foils prepared 9 Sept 1997

Foil 42 More on Interfaces -- Why use them

From Java to be used in (Scientific) Computing Part II: Java Language and Object-Oriented Concepts Basic Simulation Track for Computational Science CPS615 -- Fall Semester 97. by Nancy J. McCracken,Geoffrey C. Fox


Note that Interfaces often play a software engineering as opposed to required functional role
Note that Interfaces are not significantly used in current Java release where perhaps there are 15 times as many class definitions as interface definitions
Two examples are Runnable and Cloneable both of which extend Object class -- note interfaces like classes can extend existing classes.
The Runnable Interface has one method run() which must always be overwritten and is used to indicate that class with this interface can use threads without being a subclass of Thread. Applets must use Runnable if they need explicit threads because they explicitly are a subclass of panel and as no multiple inheritance, one cannot be a subclass of two classes



© 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.

Page produced by wwwfoil on Sun Feb 22 1998