API of a Class
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 String
- { // Constructor methods to create instances of class
- public Date ( );
- public Date ( long );
- // Accessor and Mutator methods to access and change data
- public int getTime ( );
- public void setTime ( long );
- // Other public methods
- public boolean after ( Date );
- public boolean equals ( Date );
- . . . }