Every programming language supports functions in two categories: (1) user-defined functions, and (2) language-supplied functions (also known as library functions). To begin with, let us start with user-defined functions.
In most object-oriented languages, either functions belong to a class or they do not belong to any particular class (free or global). In Java, every function must be a part of some class. There is no concept of free or global function.
Functions are small pieces of code doing a particular task. Functions are called methods in Java. Hence, the name of the topic should have been “methods in Java”.
So far, we have not introduced objects. Hence, you may not appreciate the significance of ...