From the course: Learning Java 11

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

What are functions? (conceptually)

What are functions? (conceptually) - Java Tutorial

From the course: Learning Java 11

Start my 1-month free trial

What are functions? (conceptually)

- [Instructor] So far, we've created code that has run sequentially, one line after the other. We have also written code that manipulates the program's control flow with if statements and loops. The way we have written code so far has more to do with the way that it's executed, rather than the way it's designed. In the next two chapters, we'll be focusing more on program design, and how we can create programs that are readable, and easily understood by other software developers. In this chapter, we'll be looking at functions. In software development, a function is just a series of finite steps that accomplish some task. Let's say we have the task of creating a peanut butter and jelly sandwich. The first step would be to gather the ingredients: two slices of bread, peanut butter, jelly, a knife, a plate. The next step would be to spread the peanut butter on one slice, and jelly on the other slice. Next, you would put the two slices together to create the sandwich, and finally, you…

Contents