A method is a block of code that performs a specific task.
Methods help you organize your code into reusable pieces instead of writing the same code multiple times.
After defining a method, you need to call it to run the code inside it.
The method name followed by parentheses executes the method.
Methods can take parameters, which are inputs passed into the method.
This allows methods to work with different values each time they are called.
Some methods return a value using the return keyword.
Instead of just printing something, these methods send a result back to where they were called.
A void method does not return a value. It simply performs an action.
A method with a return type sends a value back.
Method overloading allows you to create multiple methods with the same name but different parameters.
This makes your code cleaner and easier to use.
Methods are essential for writing clean and maintainable code.
Create a method that takes two numbers and returns their average.