A function is a self-contained block of code written once for a particular purpose, but can be used again and
again. It is a basic entity for Java programming language. Even the execution of the program starts from the
main function. It is the basic building block for modular programming.
Depending on the parameters and return type (discussed later on), functions are classifi ed into four
categories:
1. No return type and no arguments/parameters.
2. No return type but arguments/parameters.
3. Return type but no argument/parameters.
4. Return type with argument/parameters.
All the above ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.