Functions and Methods
You have already seen functions and methods in previous chapters. Instead of using existing functions and methods, now we will now focus on how to create your own functions and methods. You may have already heard of functions and methods from other programming languages. Java methods are often known by different names in other programming languages. Some programming languages will refer to methods as subroutines, functions or sub-programs.
Regardless of what term methods go by their role is the same. A method or function allows you to take a commonly used piece of code and reuse it. If you are writing a program to manage an address book you will likely need to sort data at some point. You would likely isolate the sorting logic in a single method named “sort”. Methods and functions are nearly the same. The only difference between a function and a method is:
- Methods do not return a value
- Functions do return a value












