A method is a group of instructions that is given a name and can be called up at any point in a program simply by quoting that name. You can also call Java method as a set of Java statements which can be included inside a Java class.Here is an example of a typical method declaration:
Code:
public double calculateAnswer(double wingSpan, int numberOfEngines, double length, double grossTons) {
//do the calculation here
}
Although a method name can be any legal identifier, code conventions restrict method names. By convention, method names should be a verb in lowercase or a multi-word name that begins with a verb in lowercase, followed by adjectives, nouns, etc. In multi-word names, the first letter of each of the second and following words should be capitalized.
Bookmarks