Utility class
Encyclopedia
In computer programming
Computer programming
Computer programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages. The purpose of programming is to create a program that performs specific operations or exhibits a...

, a utility class is a class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

 that defines a set of methods that perform common, often re-used functions. Most utility classes define these common methods under static (see Static variable
Static variable
In computer programming, a static variable is a variable that has been allocated statically — whose lifetime extends across the entire run of the program...

) scope. Examples of utility classes include java.util.Collections http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html which provides several utility methods (such as sorting) on objects that implement a Collection (java.util.collection http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html ).

External links

  • Utility Pattern: For a utility class, which does not require instantiation and only has static methods, use a private constructor
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK