Program Schematic

Purpose:

To define a general template for your Java programs.

Mechanics:


package <package name>;

/**
  * Class comment describing the class purpose.
  */

class <class name> {

    /**
      * Instance variable comment describing variable's purpose.
      */

    private <variable type1> <variable name1>;

    private <variable typeN> <variable nameN>;

    /**
      * Method comment describing what method does and when, where,
      * and why it might be used (called).
      */

    public <return type1> <first method name>() {

        // Java statements which define method go here.
        // Can include method calls, declaring local variables,
        // and return statements.
        // Should include comments!
    }

    public <return typeN> <method nameN>() {

        // More Java statements.
    }
}

Usage:

  • Each class should be in its own file.
  • The applett class should contain only instance variables.
Back to the Table of Contents
email suggestions to: cs015tas@cs.brown.edu