About This Chapter
Functions & Modules in Programming- Chapter Summary
This informative chapter is made up of concise and easy-to-understand lessons on modules and functions in programming. You'll review methods in Java; the purpose of a main method in Java; and private, protected and public Java keywords. Feel free to go back as many times as needed to review this information until you're confident. This resource is self-paced so you can utilize it at your leisure. One of our experts is available to answer any questions you might have. After you finish this chapter, you should be ready to:
- Define final keyword in Java
- Give examples of static methods in Java
- Differentiate between non-static and static methods in Java
- Use static methods in practical applications
- Explain modular programming in Java
- Use arrays as arguments to functions
- Detail the application of recursion in Java
- Differentiate between the methods for iteration and recursion
- Outline recursion in Java as it applies to data structures
1. Methods in Java: Definition & Example
Java programs have methods that have a name and contain a set of statements or instructions. In this lesson, we'll learn how the Java programming language uses methods and the rules and syntax we need to employ when using them.
2. What is a Main Method in Java? - Definition & Purpose
In this lesson you will learn about the special Java method named 'main', the meaning of the arguments passed into it, and how to use them to get your program running smoothly.
3. Java Keywords: Protected, Public & Private
Java is great at protecting objects. What does it mean to protect an object? Protected, public and private are keywords used to control access. This lesson will define the concepts and provide real-world examples.
4. Java: Final Keyword
...And that's final! The final keyword in Java is a simple tool, but it is the programming equivalent of these words. This lesson will cover the concept of Final and provide some real-world examples how how to use the final keyword to protect and clean Java code.
5. Static Method in Java: Definition & Example
In this lesson you will learn about the static methods in Java and how they are defined and used. You will also learn how they are similar and different from the instance methods.
6. Static vs. Non-Static Methods in Java
In Java, a static method belongs to the class. A non-static method, on the other hand, belongs to an object of a class. In this lesson, we will learn more about static and non-static methods in Java.
7. Practical Application for Java: Using Static Methods
In this practical application, you will create a program that utilizes a static method. You will modify the application so that it allows arguments to be passed to a method, which will return a value to the calling function.
8. Modular Programming: Definition & Application in Java
In this lesson, you will learn about modular programming and related terminology and concepts as well as object-oriented programming (classes, attributes, methods, instances of a class).
9. Using Arrays as Arguments to Functions in Java
In this lesson, you will review the basics of Java arrays. You will also learn how you can pass arrays as arguments to methods in Java, and how to return arrays from methods.
10. Recursion in Java: Application & Examples
In this lesson, you will learn how to apply recursion in Java. We will cover several methods for recursion, including factorials, Fibonacci series, and the Tower of Hanoi game. Working code examples are provided.
11. Methods for Recursion vs. Iteration in Java
We can use the techniques of recursion and iteration in our Java programs to manipulate data and perform repetitive operations. Knowing when to use each technique is as important as knowing how to program each one.
12. Practical Application for Data Structures: Recursion in Java
In this practical lesson, you will create an algorithm that uses recursion to calculate factorials. You will be able to build, compile, run, and test your program.
Earning College Credit
Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.
To learn more, visit our Earning Credit Page
Transferring credit to the school of your choice
Not sure what college you want to attend yet? Study.com has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.
Other chapters within the Computer Science 109: Introduction to Programming course
- Computer Programming Basics
- Built-In Data Types for Programming
- Conditionals & Loops in Programming
- Arrays in Programming
- Input & Output in Programming
- Object-Oriented Programming Overview
- Algorithmic Analysis, Sorting & Searching
- Stacks & Queues for Data Structures
- Tables, Maps & Graphs in Programming