However, classes have a second function. They are used to describe objects. In this role, the class of an object specifies what subroutines and variables are contained in that object. For example, String is actually the name of a class that is included as a standard part of the Java language. So, every subroutine is contained either in a class or in an object.
Classes contain subroutines called static member subroutines.
Classes also describe objects and the subroutines that are contained in those objects. This dual use can be confusing, and in practice most classes are designed to perform primarily or exclusively in only one of the two possible roles. For example, although the String class does contain a few rarely-used static member subroutines, it exists mainly to specify a large number of subroutines that are contained in objects of type String . Another standard class, named Math , exists entirely to group together a number of static member subroutines that compute various common mathematical functions. To begin to get a handle on all of this complexity, let's look at the subroutine System.out.print as an example.