• Methods are the key to making programs flexible, useful and easy to code
  • Methods allow us to re-run specific pieces of code at any given moment
    • ex. user clicks “login”, so now we need to validate their credentials
  • Methods are a way to gather or “clump together”, code into logical groupings.
    • Group code together by tasks: validate user, create new user, change user's password
  • Methods can allow you to extract a piece of information once they've completed their execution
    • this is called a “return value”
    • ex. isUserValid? Yes or No? The answer to the question isUserValid is the return value, which is a boolean
  • Methods don't HAVE to return anything though, like if you just want to create a new user. You call the “createNewUser” method, and the user can get inserted into a database. We don't need to know anything else about the operation.


Read the following post about methods: https://www.coderscampus.com/what-is-a-method-in-java/

Free Java Roadmap

Discover exactly what you need to learn and where to start in order to become a professional coder.