Contents

keyboard_tab

The course is part of this learning path

Course Overview
Overview
Difficulty
Intermediate
Duration
1h 19m
Students
4
Description

This course looks at methods, which are named, self-contained blocks of code that you can call upon to help solve problems for you. We'll then take a look at some projects which will put methods into practice.

Learning Objectives

  • Understand the fundamentals of writing your own methods
  • Learn how to classify methods by their return types as well as their parameters
  • Learn about parameter passing schemes that are used by programming languages to determine how methods treat their parameters
  • Explore method overloading and two-dimensional arrays

Intended Audience

  • Beginner coders or anyone new to Java
  • Experienced Java programmers who want to maintain their Java knowledge
  • Developers looking to upskill for a project or career change
  • College students and anyone else studying Java

Prerequisites

This is a beginner-level course and can be taken by anyone with an interest in learning about Java.

Transcript

In the previous section, we learned about arrays and ArrayLists, our first data structures, and how they can contain elements of data that we can use in our programs. In this section, we will focus on how to write named, self-contained blocks of code that we can call upon to help us solve problems for us, called methods. We have used methods before, such as the print and println methods of the System.out object or nextLine method of scanner and the main method. However, this section will teach you the fundamentals of writing your own methods, so-called user-defined methods. We'll talk about how to classify methods by their return types as well as their parameters. 

We'll also talk about parameter passing schemes that are used by programming languages to determine how methods treat their parameters. We will explore the exciting topic of method overloading, where we can have multiple methods with the same names but different parameter lists. As a side topic, we will learn about two dimensional arrays but also how to pass them to methods and work with them in those methods. We will finish off this section with a couple of great projects, including a Sum of Elements project where we sum and return the elements in an array, as well as an incredibly challenging project, where you will get to show off your skills. That will be the Tic-Tac-Toe project. 

You will have to put everything together that we've learned thus far and come up with a strategy to solve this problem and implement the classic tic-tac-toe or noughts-and-crosses game. Without further ado, let's get to the first content lecture in this section on user-defined methods. I'll see you there.

 

About the Author
Students
157
Courses
20
Learning Paths
3

John has a Ph.D. in Computer Science and is a professional software engineer and consultant, as well as a computer science university professor and department chair.

Covered Topics