See the tutorial: Defining Methods (The Java™ Tutorials > Learning the Java Language > Classes and Objects)