Basic HTML version of Foils prepared Sept 6 1998

Foil 17 API of a Class

From Java Tutorial 98-2: Java Language and Object Oriented Techniques CPS606 Fall Semester 1999 -- Sept 7 1999. by Geoffrey C. Fox, Nancy McCracken

Sun API links for Foil 17
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);
  • . . . }



© 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 Mon Sep 6 1999