Previously, we saw the simple method. This method took no input and returned no output. It just printed a String.
In reality, methods usually take one (or more) inputs.
These inputs are called "parameters".
Now let's take the simple method, and create a simple2() method that takes a String parameter, called name. We can now use the "name" input inside the method.
Now, when we run this we'll get this output:
You can now see that the method can be called anywhere in the code, and you can pass whatever String to it.
The methods we saw so far did not return anything. But we can make the methods return whatever datatypes we want.
Let's do a simple sum method, which takes 2 numbers as input, and returns their sum as their output:
When we run this, we get this output:
Here is another example, this time let's return a String. We'll pass first name and last name, and get back their full name.
When we run this, the output is:
Seriously, there is nothing more complex than this on methods, parameters and return types!