• 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 Beginners Course

Start learning how to code today with our free beginners course. Learn more.

Thank you for your message. It has been sent.
There was an error trying to send your message. Please try again later.