When students complete Introduction to Java, they will be able to:
- Use core programming concepts such as classes, variables, methods, conditional logic, and looping to write effective Java programs
- Model data with Java’s array data structure and understand how to use complex topics like recursion to elegantly express a real-world problem with code
- Create useful programs and simple games using the Java programming language.
No prerequisites for this course. Beginners with no experience are welcome.
- 1. Introduction
In the first lesson of this course, students learn about programming in general and how to write a simple Java program that lists our favorite food. We cover some fundamental ideas behind Java programming, such as creating classes, the importance of the main method, and the syntax and structure of simple statements.
- 2. Data
In this lesson, students learn how to describe real-world objects by their data and behavior. Programmers use variables to represent data and methods to model behavior. The lesson’s project has the students model a movie review using variables and Java’s essential primitive data types.
- 3. Methods
In this lesson, students use methods to package related code. Using methods reduces repetition and follows the D.R.Y. programming methodology. The day’s project has the students refactor the movie review application from the previous class to use a user-defined method instead of repetitive print statements.
- 4. Arithmetic Operators
In this lesson, students learn how to return data from methods and work with Java’s four fundamental arithmetic operations. We introduce type casting operations to ensure that mathematical expressions return the expected results and review the order of operations as it pertains to Java programs. The day’s project is a “Smart Calculator” app that reinforces the lesson concepts and allows students to build a helpful calculator that they can use outside CWHQ.
- 5. Relational Operators
In this lesson, students learned how to make decisions using conditional statements. They also learn about the different relational operators and how to work with the modulo operator. They’ll put their new skills to work by adding more features to the “Smart Calculator” application from the previous lesson.
- 6. Loops
In this lesson, students learn two of Java’s looping constructs; the “for” and “while” loops. They’ll learn how loops are used to apply the DRY (Don’t Repeat Yourself) programming principle, and they’ll use loops to reduce repetition in their code and create different arithmetic tables. The final portion of the lesson introduces two ways to interrupt loops; the “break” and “continue” statements.
- 7. Arrays
In this lesson, students learn about a fundamental data structure in Java, the array. Students will learn how to create and iterate through arrays with loops (which they learned in the previous class). They’ll also be introduced to method overloading, which allows a programmer to create duplicate methods that accept different data but perform the same action. For the final exercise, students learn to use pseudocode to outline an algorithm before writing any Java code.
- 8. Multidimensional Arrays
In this lesson, students learn how to group related arrays into multidimensional arrays. They’ll create and iterate through a few multidimensional arrays in a program that models a shopping list and a log of daily activities. In addition to standard array operations, we introduce the Arrays utility class of the Java standard library to perform common array tasks, such as sorting and searching arrays.
- 9. Logical Operators
In this lesson, students learn about complex conditional statements, which allow your program to make a decision based on multiple situations. They’ll build a simple “Slot Machine” app to test complex conditional statements and learn how to generate random numbers within any range. At the end of class, students learn how to use helper methods to hide the complexity of complex conditional statements and make their code more readable.
- 10. Recursion
In this lesson, students learn how to use recursion in place of repetition. We discuss two types of recursive methods and practice converting looping constructs into recursive ones. This concept is challenging to grasp, so the lesson is packed with examples and graphics to help illustrate the ideas, and the program we write is very minimal and straightforward.
- 11. Final Project – Part 1
In this lesson, students start with an empty project and build a working “Rock, Paper, Scissors” app using what they’ve learned throughout the course. No new concepts are introduced in this lesson, as it is meant to showcase how far the students have come. The students will improve this app for homework and in the course’s final class.
- 12. Final Project – Part 2
In the final lesson of this course, students continue to add features and improve the “Rock, Paper, Scissors” app from the last class using techniques they’ve learned throughout the course. They’ll add a way to run the game multiple times and determine who won a series of games. As a bonus, we learn how to run tie-breaker logic until one player wins.