method in Java

Methods are declared within a class, and that they are used to perform certain actions.
<b>Parts of a method declaration</b>
Element|Example|Required?
-----|-----|-----
Access modifier<br>Optional modifier |public<br>final |No<br>No
Return type |void |Yes
Method name |walk |Yes
Parameter list |(int minutes) |Yes, but can be empty parentheses
Optional exception list |throws InterruptedException |No
Method body |{ /* take a walk */ } | Yes, but can be empty braces

The method name is an identifier may only contain letters, numbers, $ , or _ .

To call this method, just type its name, followed by a single int value in parentheses:
```
walk(10);
```