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

Foil 37 Comments on Examples Point, Canvas, Rectangle

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

Java methods can be overloaded (i.e. allow for multi-valued declaration with various argument patterns -- see e.g. move() method) in a similar way as class constructors.
Canvas inherits move() method, and overrides inverse() method (by adding color inversion, i.e. "inverse video").
paint() method operates on Graphics object from Sun's Java class library which is included via the import statement.
We used the interface construct to separate 2D translational degrees of freedoms (which are handled as Movable methods) from the internal coordinates (which are handled by individual classes).
Note that interfaces can only contain static (global) variables (here, x=0.0, y=0.0 which is the default origin for Point() constructor).
  • This allows one to avoid the usual ambiguities with multiply inherited instance variables in case of closed loops in the inheritance graph.



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