Methods

A method is a named block of code that groups a reusable piece of processing. Its signature specifies its return type, its name, and its parameters; void indicates that it returns nothing, and return sends back a value. Breaking a program down into small methods makes it readable and testable.

Example

static int carre(int x) {
    return x * x;
}

Related concepts

The whole glossary