High school boy with backpack

Course Description

In Java 2, the final course of our AP CS-focused curriculum, students learn the fundamental principles of Object-Oriented Programming (OOP). They’ll learn how to model real-world data using OOP concepts like encapsulation, inheritance, composition, and polymorphism. While this course focuses on OOP in the Java programming language, most ideas are transferrable to any mainstream object-oriented language. After completing this course, students will be well-prepared to enter a traditional AP Computer Science A course and hit the ground running!

High school boy in codewizardshq platform

Learning Objectives

When students complete Java 2, they’ll be able to:

  • Model real-world objects using Object-Oriented Programming and the Java programming language.
  • Understand when to use OOP concepts like inheritance, composition, polymorphism, and interfaces.
  • Create practical applications and games that use OOP to organize the major software components.
Level I

Prerequisites

These courses must be completed before Java 2:

  • Wizard Level 1, Course 1 :  Java 1

Java II Class LessonsExpand All Lessons
  • Java Class 1
    1. Introduction to OOP

    In the first lesson of this course, students are introduced to Object-Oriented Programming (OOP). This lesson covers the basics, such as defining classes, creating objects from classes, and accessing and modifying an object’s properties. Students will build a simple program that models musical albums during the lesson and refine this project for homework. 

  • Java Class 2
    2. Data & Methods

    In this lesson, students solidify Object-Oriented Programming (OOP) concepts introduced in lesson 1 by building a small application modeling contact information. The students will practice defining a class, creating class instances, and will learn new techniques to validate data assigned to the class. The null value is introduced, and we show a few strategies for ensuring data integrity around null values and text length.

  • Java Class 3
    3. Encapsulation

    In this lesson, students learn about Encapsulation, a fundamental OOP technique for protecting the integrity of object data. They’ll learn the importance of private instance variables and implement getter and setter methods to modify and access these values from outside a class. We continue our work around validating object data but move these validations into the appropriate setter methods in this lesson.

  • Java Class 4
    4. Constructors

    In this lesson, students learn how to work with and define Constructors in their Java classes. Constructors are how we build objects in OOP code, and we’ve been using them since lesson 1 but couldn’t customize them until this lesson. The “this” keyword is introduced to refer to an instance of a class from within a class. By the end of the lesson, the students will implement a working CheckingAccount class with deposit and withdrawal functionality. 

  • Java Class 5
    5. Static Data & Methods

    In this lesson, students learn how to use static variables and methods to represent data shared among all class instances. We also introduce the “final” keyword to make variables unmodifiable after they are initially set. The day’s project has them model an Avenger class (from the Avengers comic series). To complete this assignment, they will have to think about what properties all Avengers share and what properties are unique to each.

  • Java Class 6
    6. Composition

    In this lesson, students learn about a fundamental OOP concept, Composition. Composition allows programmers to create more sophisticated models of the natural world by building class models from combinations of other classes. The day’s project is to model typing and displaying text on a computer using Composition. To complete this assignment, the students hook together and model the interactions between Keyboard, Monitor, and Computer classes. 

  • Java Class 7
    7. Inheritance

    In this lesson, students learn about inheritance, a fundamental pillar of OOP. We discuss Java’s inheritance model and build a simple app that uses Mammal, Cat, and Dog classes to showcase the potential of inheritance. By the lesson’s end, students should glimpse the power of inheritance for modeling real-world relationships and facilitating code reuse.

  • Java Class 8
    8. Polymorphism

    In this lesson, students learn about how polymorphism is used in OOP. Polymorphism lets different objects use the same method signature to perform individual actions. Students learn how to use polymorphism in the code from the previous lesson to move common behaviors to a parent class. Students also learn about dynamic binding in Java, which allows programmers to harness the power of polymorphism over collections of related objects.

  • Java Class 9
    9. Abstract Classes

    In this lesson, students learn how to create and use abstract classes in Java. Abstract classes allow software developers to build generalized representations of real-world objects at a higher level of abstraction than a traditional Java class offers. The students will create a generalized Shape class which they then extend to make unique Rectangle and Circle classes. To complete the lesson assignment, students must recognize the commonalities between all shapes and distinguish the characteristics that make individual shapes different.

  • Java Class 10
    10. Interfaces

    In this lesson, students learn how to use interfaces to model and share abstract behaviors between disparate classes. Interfaces are the final concept students must understand to have a well-rounded OOP foundation. We create two general-purpose interfaces in the lesson; one for movement and one for drawing objects to the screen. Sharing behavior between seemingly unrelated classes is a powerful tool for software developers using an OOP language like Java. 

  • Java Class 11
    11. Final Project – Part 1

    In this lesson, students work on part 1 of the course’s final project. They’ll create a game that simulates a battle between two characters using OOP techniques they’ve learned throughout the course. We’ll work with abstract classes, encapsulation, inheritance, and polymorphism in part 1 of the project, and they’ll cover the remaining OOP concepts in the homework assignments and part 2 of the project. 

  • Java Class 12
    12. Final Project – Part 2

    In the final lesson of this course, students will finish the emoji battle app they began in the previous class. They’ll add the ability to run multiple emoji battles using loops, then create a Scoreboard class to track the series’ winner. We conclude the course with some ideas that the students can use to improve the app further on their own.