From the course: Java Cheat Codes: Most Popular Functions

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Method parameters

Method parameters

- [Instructor] Method parameters. In this video, I'll review method parameters, explain the basic structure of a method, the concept of parameter passing and argument matching. Now let's review the structure of a method in Java, along with the perimeter passing and argument matching. The structure starts off with a method signature. This consists of the method's name, parameters, if any, and the return type. This uniquely identifies the method within a class. Next, you have the parameters. Parameters are the variables listed within the parentheses in the method signature, and they act as input values for the method when it's called. Next, you have the return type, the data type of the value that the method will return. So it could be an int, string or void for no return value, and then we have the method body. So this is the code block enclosed within curly braces that defines the method's actions, the contained statements that perform the methods task. Within this example, we see the…

Contents