Class methods are used to perform the behavior and functionality of the class. When a class instance is created, memory is allocated for the data members of the instance. The methods for the class operate on the data members of the class instance. Some methods are PRIVATE or PROTECTED and can only be called by other methods in the class. Other methods in a class may be PUBLIC, in which case they can be called by other parts of the application.

PACKAGE-PRIVATE and PACKAGE-PROTECTED provide similar restrictions at the package level. For more information, see Access modes.

You may want to have multiple methods in a class that have the same name but have a different parameter list or return type. Creating methods with the same name is called overloading methods. Overloaded methods make your classes more flexible for users of the class.

For more information see, Comparison with procedure-based programming internal procedures and user-defined functions.