Please enable JavaScript to use CodeHS

Introduction to Java (Latte)

Description

In this lesson, students will learn about four types of Data Structures. An array is a list of fixed size. An array list is a list of changing size. A 2D-Array is a grid, table, or list of lists. A Hash Map is a Key-Value store.

Objective

Students will be able to:

  • Explain the difference between an Array, an Array List, a 2D Array, and a Hash Map.
  • Choose the correct Data Structure for a given purpose
  • Understand how Data Structures fit into their programs
Description

In this lesson, students learn about arrays and make their first arrays. Arrays are one of the main data structures students will need to understand. This lesson introduces the idea, shows students how to create them, and explains how to access data elements to retrieve and update values.

Objective

Students will be able to:

  • Initialize an Array of various types
  • Access items in the list with indexes
  • Change the value of a list item using indexes
  • Find out the length of any array
Description

In this lesson, students will learn how to traverse an array to access all of the array elements. They will then apply this to real-world activities.

Traversing through an array is a key skill for many programs and as a result, this topic is covered extensively on the AP test.

Objective

Students will be able to:

  • Create arrays of various types, including objects.
  • Traverse arrays using a for loop
  • Explain what happens when a program tries to access an array index that doesn’t exist
  • Explain how different arrays can point to the same value and the implication of this.
  • Apply arrays to real-world examples.
Description

In this lesson, students will learn about ArrayLists and make their own ArrayLists. They will then learn basic methods for ArrayLists to traverse, add, and access the elements in the ArrayList.

While this lesson focuses on ArrayLists, students should be starting to think about how Arrays and ArrayLists are similar and different. This concept is key and will be further explored in the next lesson.

Objective

Students will be able to:

  • Create an ArrayList
  • Add to and access ArrayList elements
  • Traverse an ArrayList
  • Use basic ArrayList methods
Description

In the lesson, students will learn more about the differences between Arrays and ArrayLists and make an ArrayList like class using an Array.

Having learned two different data structures for storing lists, it is only natural to compare and contrast these two structures. Students should come into this lesson with a basic understanding of differences but will develop a deeper understanding through a series of examples and activities.

Objective

Students will be able to:

  • Compare and contrast Arrays and ArrayLists.
  • Explain when to use ArrayLists versus Arrays.
  • Explain how ArrayList functionality can be built off an Array structure.
Description

In this lesson, students will learn about the list interface and use this to implement generic formal parameters and create classes that use the List interface.

This lesson is not currently in scope for the AP test, but understanding how to implement and use Java interfaces is a key concept for object-oriented programming.

Objective

Students will be able to:

  • Explain what the List interface is.
  • Explain why we would use the List interface as a formal parameter
  • Explain why we would use the List interface to define a List variable.
Description

In this lesson, students will learn about 2D arrays. The will also first be exposed to the idea of a nested loop, which will be used to access all the elements in a 2D array.

2D arrays are a key idea for students to grasp. They should spend time to fully understand how the loops execute. They can further supplement these concepts through the Traversing 2D Arrays exercises in the Supplemental Material.

Objective

Students will be able to:

  • Explain how 2D arrays are created by making an array of an array
  • Represent collections of related primitive or object reference data using two-dimensional (2D) array objects.
  • Traverse 2D arrays using nested loop statements.
Description

In this lesson, students will learn about HashMaps and use them to create solutions to real-world problems. HashMaps offer a different way of storing data in Java using a key/value pair. While this topic is out of scope for the AP test, it is a key data structure used in several programming languages and may make a good topic for after the AP test.

Objective

Students will be able to:

  • Explain what a HashMap is and when it should be used versus other data structures.
  • Create, modify, and retrieve values from a HashMap.
  • Loop through all values of a HashMap using an enhanced for loop.
Description

In this lesson, students learn how to convert from different number systems to decimal. They also learn more about why binary is used by computers and have an opportunity to write a code that will convert a binary number into a decimal number.

Objective

Students will be able to:

  • Convert by hand from binary, octal, and hexadecimal to decimal
  • Explain how to convert from any number system to decimal
  • Write basic computer programs to convert numbers to decimal
Description

In this lesson, students learn about creating a large scale project using multiple classes. This lesson walks through the creation of a basic Blackjack game.

Objective

Students will be able to:

  • Understand the importance of top-down design
  • explain the process of creating a large scale project.
  • Extend another user’s code to make it their own.
Description

In this lesson, students will learn about 2D arrays and classes by creating a Battleship program. Through a series of lessons, the game will be broken down into pieces to help implement the solution.

Objective

Students will be able to:

  • Use top-down design to create a significant project
  • Strengthen skills with 2D arrays and classes.
Description

This lesson is a summative assessment of the unit’s learning objectives.

Objective

Assess student achievement of the learning goals of the unit