HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 1 February 97

Foil 4 API of a Class

From Jan 27 Delivered Lecture for Course CPS616 -- Java Lecture 2 -- Basic Applets and Objects CPS616 spring 1997 -- Jan 27 1997. by Nancy McCracken * See also color IMAGE
Secs 272.1
Each class has an API (Application Programming Interface) consisting of all the variables and methods that other programmers (i.e. in other classes) are allowed to use. These are designated by the "public" keyword.
Example showing part of the Java Date class:
  • public class Date
  • { // Constructor methods to create instances of class
    • public Date();
    • public Date(int year, int month, int day);
  • // Accessor and Mutator methods to access and change data
    • public int getHours();
    • public int getYear();
    • . . .
    • public void setHours();
    • public void setYear();
    • . . .
  • // Other public methods
    • public boolean after(Date when);
    • . . . }
The on-line Java Hierarchy and Index shows the API's of all Java 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 16 1997