What is a method in Java?

A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method’s name. Think of a method as a subprogram that acts on data and often returns a value. Each method has its own name.

For More Information Please Refer: https://mathbits.com/MathBits/Java/Methods/Lesson1.htm