From the course: Learning Java 11

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Calling functions in Java

Calling functions in Java - Java Tutorial

From the course: Learning Java 11

Calling functions in Java

- [Instructor] Now that we've defined our announceDeveloperTeaTime function we can proceed to the second step of using functions in Java. We just write the name of the function to use or execute the steps within the function. In java, when we use a function, we say we call the function. You can think of this as recalling the steps that were previously defined and executing them. Let's call a function in Java. We define our function outside of the main function but we are going to call or use our function inside of the main function. The main function is where the meat of our program gets executed but we can always recall functions that are previously defined as part of the program. Our announceDeveloperTeaTime function is one of these functions. In our main function we can write announceDeveloperTeaTime. This will called the announceDeveloperTeaTime function, execute its steps and then continue to execute whatever is…

Contents