As was the case with variables , Java gives you a lot of flexibility in choosing names for your methods , although some restrictions and conventions do apply. A method name must consist of Unicode characters and must begin with a letter. The method name cannot be a Java keyword. According to the Java Language Specification, the naming convention for Java methods is to use the camel capitalization style. The first letter of a method name is lower case. The first letter of any subsequent word in a method name is capitalized. The method name should describe what the method does. Methods that are used to access the value of a data member are, by convention, named "get" followed by the data member name. For example, a method used to retrieve the value of a variable named pressure would be called getPressure() . Methods that return the value of a boolean variable are named "is" followed by the variable name. For example, isKinetic() might be a method used to return the value of a boolean variable named kinetic . Methods used to change the value of a variable are named "set" followed by the variable name. A method used to change the value of a variable named pressure would be named setPressure() . |