HELP! * GREY=local LOCAL HTML version of Foils prepared January 8,96

Foil 33 Java Language -- Classes: An Example

From Overview of Java SC95 Tutorial on Web Technologies -- December 4,95. by NPAC Team * See also color IMAGE

We illustrate essential elements of Java object-oriented programming on the following example.
The following three classes are declared:
  • Point -- a pair of floating point coordinates in a unit square
  • Rectangle -- an ordered pair of Points
  • Canvas -- a Rectangle with additional color information
and they are all made Movable (i.e. they all implement Movable interface).
Declaration of Interface Movable:
  • public interface Movable
  • {
  • static float x = 0.0, y = 0.0;
  • public void move(float dx, float dy);
  • public void move();
  • } // end interface Movable



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 Tue Feb 18 1997