...

/

Parameters and Return Types in Methods

Parameters and Return Types in Methods

In this lesson, we take a closer look at the parameters and return types of methods in Java.

We'll cover the following...

Parameters

The parameters are the inputs that a Java method takes. These are given as an ordered list in parentheses next to the name of the method. We can have any number of parameters.

  • If a method does not have any parameters, the parentheses are left empty.

    public static void function()
    {
      // implementation here
    }
    
  • Otherwise, ...