next up previous
Next: Examples of definitions of Up: Unit 03 Previous: Methods seen as modules

Definition of static methods

In Java, the simplest forms of methods are the static methods.

Static methods are methods (defined in a class) that do not have an invocation object.


Definition of a static method

Syntax:
header block

Semantics:

Defines a static method by specifying its header and body.

Example:

The static method main, used before. Such a method has always the form:

public static void main (String[] args) {
  ...
}

The header of the main method shows that:


Note: The definition of a method does not cause its activation.


next up previous
Next: Examples of definitions of Up: Unit 03 Previous: Methods seen as modules