Functions are central in Java. We’ll learn about functions (known as methods in Java) with a few different examples.
To run the program, compile and execute it using the javac and java commands:
There are several other features to Java methods. One is method overloading, which allows multiple methods with the same name but different parameter lists. We’ll look at this in future examples.