Please enable JavaScript to use CodeHS


Introduction to Java (Latte)

Lessons

  1. Introduction to Programming in Java with Karel the Dog

    1. 1.1 Introduction to Programming With Karel

    2. Description
    3. Objective

      Students will be able to…

      • Write their first Karel program by typing out all of the Karel commands with proper syntax.

      • Explain how giving commands to a computer is like giving commands to a dog.

    4. 1.2 More Basic Karel

    5. Description

      In this lesson, students learn more about Karel and Karel’s world. Students learn about walls in Karel’s world, the directions Karel can face, and how to identify a location in Karel’s world using streets and avenues. In these exercises, students will begin to see the limitations of Karel’s commands. Students will need to apply Karel’s limited set of commands to new situations. For example, how can they make Karel turn right, even though Karel does not know a turnRight command?

    6. Objective

      Students will be able to…

      • Identify the direction that Karel is facing
      • Predict what direction Karel will be facing after executing a series of commands
      • Identify a location in Karel’s world using Street, Avenue terminology
    7. 1.3 Java Programs and the Run Method

    8. Description
    9. Objective

      Students will be able to…
      * Explain the purpose of the Run Method
      * Explain the first thing that happens in your program when you click the Run button.
      * Write a fully-formed Java program by including a class and a run method.

    10. 1.4 Karel Can't Turn Right

    11. Description
    12. Objective

      Students will be able to…
      * Teach Karel a new command by creating a turnRight() method
      * Utilize the turnRight() method they created to write cleaner, clearer Karel programs
      * Explain the difference between defining and calling a method

    13. 1.5 Methods in Karel

    14. Description
    15. Objective

      Students will be able to…
      * Create methods to teach Karel new commands
      * Utilize these methods to write higher level Karel programs that go beyond the basic toolbox of commands that Karel starts with

    16. 1.6 Top Down Design and Decomposition in Karel

    17. Description
    18. Objective

      Students will be able to…
      * Break a large problem down into smaller, simpler problems
      * Write methods that solve the simpler problems, and use them as building blocks to solve the larger problem
      * Compare programs and identify good vs poor decomposition

    19. 1.7 Commenting Your Code

    20. Description
    21. Objective

      Students will be able to…
      * Explain the preconditions and postconditions of a method
      * Create clear and readable comments in their code that help the reader understand the code
      * Explain the purpose of comments

    22. 1.8 Super Karel

    23. Description
    24. Objective

      Students will be able to…
      * Write programs that use SuperKarel instead of Karel
      * Utilize the new toolbox of commands that SuperKarel provides over Karel
      * Read documentation to understand how to use a library (SuperKarel is an example of this)

    25. 1.9 For Loops

    26. Description
    27. Objective

      Students will be able to…
      * Create for loops to repeat code a fixed number of times
      * Explain when a for loop would be a useful tool
      * Utilize for loops to write programs that would be difficult / impossible without loops

    28. 1.10 While Loops in Karel

    29. Description
    30. Objective

      Students will be able to…
      * Explain the purpose of a while loop
      * Create while loops to repeat code while a condition is true
      * Utilize while loops to solve new types of problems
      * Test their solutions on different Karel worlds

    31. 1.11 If Statements

    32. Description
    33. Objective

      Students will be able to…
      * Use conditions to gather information about Karel’s world (is the front clear, is Karel facing north, etc)
      * Create if statements to only execute code if a certain condition is true

    34. 1.12 If/Else Statements

    35. Description
    36. Objective

      Students will be able to…
      * Explain the purpose of an If/Else statement
      * Create If/Else statements to solve new types of problems
      * Identify when an If/Else statement is appropriate to be used

    37. 1.13 Control Structures Example

    38. Description
    39. Objective

      Students will be able to…
      * Identify the different control structures we can use to modify the flow of control through a program
      * Combine control structures to solve complicated problems
      * Choose the proper control structure for a given problem

    40. 1.14 More Karel Examples and Testing

    41. Description
    42. Objective

      Students will be able to…
      * Analyze a solution to a problem and explain why it works
      * Use control structures to create general solutions that work on all Karel worlds

    43. 1.15 How to Indent Your Code

    44. Description
    45. Objective

      Students will be able to…
      * Explain why it is important to indent code
      * Identify proper indentation
      * Modify a program to have proper indentation
      * Write programs with proper indentation

    46. 1.16 Karel Challenges

    47. Description
    48. Objective
    49. 1.17 Unit 1 Quiz

    50. Description
    51. Objective
  2. Basic Java

    1. 2.1 Printing in Java

    2. Description

      This lesson discusses printing a message in Java. Instead of extending Karel, students will now extend Console Program to print to the Console.

      public class Welcome extends ConsoleProgram
      {
          public void run()
          {
            System.out.println("*insert message here* "); 
            System.out.println("*insert message here* "); 
          } 
      }
    3. Objective

      Students will be able to:

      • call system class methods to generate output to the console
      • recognize the difference between display behavior of System.out.print and System.out.println
      • create string literals
    4. 2.2 Variables and Types

    5. Description

      Variables allow us to store information such as numbers, words, or true/false expressions. A variable can be thought of as a box that stores information inside. In Java, variables are composed of three things: a name, type, and value.

    6. Objective

      Students will able to write programs using variables by declaring, initializing and assigning a value to their variable.

    7. 2.3 User Input

    8. Description

      In this lesson, students will learn how to retrieve user input by various methods including readLine, readInt, readDouble, and readBoolean. This will allow them to take in data from the user to make our programs work for them.

    9. Objective

      Students will be able to ask for user input and print out the input in the console program by using readLine, readInt, readDouble, and/or readBoolean.

    10. 2.4 Arithmetic Expressions

    11. Description

      Arithmetic Expressions allow us to perform mathematical operations within Java. Such expressions can be used for basic math and even more complex algorithms.

    12. Objective

      Students will able to

      • write programs with arithmetic expressions in their programs.
      • use increment and decrement shortcuts when writing their code.
    13. 2.5 Casting

    14. Description

      This lesson introduces the students to Casting, which is turning something of one type into another type.

    15. Objective

      Students will be able to…

      • Cast a variable of one type to another type
      • Explain the purpose of casting
      • Use casting to divide two ints and preserve the fractional part of the result
      • Use casting to round a double to the nearest int
    16. 2.6 Booleans

    17. Description

      How do we write code that tells us whether a user is logged in to our program? Booleans are the solution to these questions. A boolean refers to a value that is true or false. Those are the only values of a boolean expression, and these are useful if we want to check if something is true or false.

    18. Objective

      Students will be able to…

      • Create boolean variables to represent meaningful yes/no values
      • Print out the value of a boolean variable
    19. 2.7 Logical Operators

    20. Description

      Logical operators allow us to connect or modify Boolean expressions. Three logical operators are the !, ||, && characters.
      ! = NOT
      || = OR
      && = AND
      Logical operators can be used in combination.

      With these logical operators, we can construct logical statements such as “I go to sleep when I am tired OR it’s after 9pm”, “I wear flip flops when I am outside AND it is NOT raining”

    21. Objective

      Students will be able to…
      * Describe the meaning and usage of each logical operator: OR (||), AND (&&), and NOT (!)
      * Construct logical statements using boolean variables and logical operators

    22. 2.8 Comparison Operators

    23. Description

      Comparison operators let us compare two values. Using comparison operators in programming is similar to math in that less than <, greater than >, less than or equal to <=, and greater than or equal to >= are the same. The differences are that operators for equal to are == and not equal are !=. Using comparison operators allows our program to make decisions.

    24. Objective

      Students will be able to…
      * Explain the meaning of each of the comparison operators (<, <=, >, >=, ==, !=)
      * Create programs using the comparison operators to compare values
      * Predict the boolean result of comparing two values
      * Print out the boolean result of comparing values

    25. 2.9 For Loops

    26. Description

      This lesson explores for loops–why they are useful, and how to use them to repeat code a fixed number of times.

    27. Objective

      Students will be able to…
      * Create for loops to repeat code a fixed number of times
      * Explain when a for loop would be a useful tool
      * Utilize for loops to write programs that would be difficult / impossible without loops

    28. 2.10 While Loops

    29. Description

      Just like in Karel, Java has while loops. While loops are a way to repeat a block of code so long as some condition remains true. The condition is written in the form of a boolean expression. As long as the boolean expression remains true, code within the while loop will be executed. The moment that the boolean expression becomes false, code outside of the while loop will be executed; the loop is done.

    30. Objective

      Students will be able to…

      • Explain the purpose of a while loop
      • Create while loops to repeat code while a condition is true
      • Utilize while loops to solve new types of problems
    31. 2.11 If Statements

    32. Description

      This lesson introduces If Statements. We use if statements to run a segment of code only if some boolean expression first evaluates to true.

    33. Objective

      Students will be able to…
      * Explain the purpose of if statements
      * Create their own if statements to selective choose which code is executed in their programs

    34. 2.12 Loop-and-a-Half

    35. Description

      Infinite loops can occur unintentionally if you are not careful with the conditions of a while loop. In these cases, the infinite loop can cause the program to crash. However, infinite loops can be a very useful tool in programming. If your program needs to repeat a block of code an indefinite number of times, an infinite loop may be the correct approach. Repeating code is helpful, but it’s just as important to be able to stop the loop so that the rest of the program can continue executing. Loops can be stopped using the break statement. When the loop encounters a break statement, it quits running the loop and program flow continues.

    36. Objective

      Students will be able to…

      • Explain the how the loop-and-a-half structure is different from a traditional while loop
      • Explain what an infinite loop is
      • Explain what the break statement does
      • Create programs that use the loop-and-a-half structure to repeat code until a SENTINEL is met, causing the program to break out of the loop
    37. 2.13 Short-Circuit Evaluation

    38. Description

      This lesson introduces Short-Circuit Evaluations. In a Short-Circuit Evaluation, if the result of a Boolean Expression can be determined by the first argument, the second argument is not evaluated.

    39. Objective

      Students will be able to…

      • Explain what short circuit evaluation is
      • Explain why short circuit evaluation is useful
      • Identify situations where Java will use short circuit evaluation when running a program
      • Create programs that use short circuit evaluation to prevent crashing
    40. 2.14 De Morgan's Laws

    41. Description

      De Morgan’s Laws are rules that show how we can negate “and”s and “or”s. Not (A and B) is the same as (not A) or (not B). Similarly, not (A or B) is the same as (not A) and (not B).

    42. Objective

      Students will be able to…

      • Explain what De Morgan’s Laws are
      • Use De Morgan’s Laws to negate an OR statement
      • Use De Morgan’s Laws to negate an AND statement
    43. 2.15 Strings

    44. Description

      A String is a sequence of characters. We use Strings to represent full words and sentences. For example, the famous “Hello World” is a String. Some more examples of Strings:
      “I am a String. A sequence of characters strung together to form words and/or sentences.”
      “CodeHS is the best coding website ever! Everyone loves CodeHS!”
      “She sells sea shells by the sea shore.”
      “Strings!”
      “abcdefghijklmnopqrstuvwxyz”
      A String is not a primitive type like int, char, boolean, and double are. Primitive types always start with lowercase letters, but a String starts with a capital letter. This makes it an object.

    45. Objective

      Students will be able to…

      • Explain that a String is a sequence of characters
      • Explain the difference between a String and a primitive type
      • Create String variables and initialize them to hold String values
      • Concatenate String values together
      • Compare Strings correctly using .equals instead of ==
    46. 2.16 Unit 2 Quiz

    47. Description

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

    48. Objective

      Assess student achievement of the learning goals of the unit

  3. Methods

    1. 3.1 Java Methods

    2. Description

      In this lesson, we learn about methods in Java. Methods allow us to break down our code into reusable parts, avoid using repeated code, and simplify our code.

    3. Objective

      Students will be able to…

      • Explain the purpose of methods
      • Create their own methods
      • Utilize their methods to solve simple problems
    4. 3.2 Methods and Parameters

    5. Description

      In this lesson, we continue to build our understanding of methods and introduced to parameters. Parameter are inputs to methods.

      If methods are boxes, then parameters are inputs to our boxes (what goes inside the box).

      Parameters allow us to generalize our methods so that they can solve more than one specific instance of a problem, and instead can solve different versions of the same problem (for example, add 10 to any given number).

    6. Objective

      Students will be able to…

      • Write general methods that take parameters as inputs.
      • Use parameters to generalize their methods to solve general problems.
      • Identify and fix improper parameter names in Java.
    7. 3.3 Methods and Return Values

    8. Description

      Think of a method like assigning a task. A return value is giving you the completed work.
      This allows you to write methods that do some work for you and send back the result.
      Parameters are like inputs into the function, and the return value is output.

    9. Objective

      Students will be able to…

      • Explain the purpose of returning a value from a method.
      • Create methods that return values.
      • Create programs that call methods with return values and store the result for later use.
    10. 3.4 Javadocs and More Methods

    11. Description

      Comments are an important part of programming style. Programs are usually written by teams of people and maintained for many years. Others need to be able to read your code and understand what is going on.

      This lesson introduces Javadocs, which are a standard, agreed upon way of commenting Java code. There is a tool, also called Javadoc, that is able to read Javadoc comments and create clean, clear documentation for your Java programs. Javadoc refers to both the tool and the style of commenting Java code.

      From now on, we will be writing Javadoc comments in our programs.

    12. Objective

      Students will be able to…

      • Explain why commenting your code is important
      • Identify Javadoc style comments
      • Analyze a given program for proper documentation
      • Compare and contrast programs with good documentation against programs with poor documentation
      • Create Javadoc comments to document their methods
    13. 3.5 Strings Methods

    14. Description

      Strings come prepackaged with several methods that we can use to help us do cool things! In this lesson we learn how to find and read documentation about how to use the String methods, and we’ll write several programs that call methods on Strings in order to get information about them and manipulate them to form new Strings.

    15. Objective

      Students will be able to…

      • Read documentation for how to use the methods of the String class
        • Either in the DOCS tab in the CodeHS editor, or elsewhere online
      • Call methods on String objects to get information about the String, such as length or characters at given indices
      • Utilize String methods to create programs that manipulate Strings in interesting ways
    16. 3.6 Strings and Characters

    17. Description

      In this lesson, we’ll examine the similarities and differences between the String class and the char primitive type. Strings are simply sequences of chars.

      We also learn that all char values have a corresponding int value. chars are actually stored as numbers! For example, 65 corresponds to ‘A’, 66 corresponds to ‘B’, and so on. We’ll learn about special characters like tabs, quotes, and new lines, and how to store and print these special characters using escape sequences like ‘\n’

      Lastly, we learn about the Character class. The Character class provides several useful methods that allow us to manipulate and get information about char values.

    18. Objective

      Students will be able to…

      • Explain the relationship between Strings and chars
      • Explain the difference between the primitive type char and the class Character
      • Convert char values to int values using casting
      • Convert int values to char values using casting
      • Print out special characters like quotes and new lines using escape sequence chars (such as ‘\n’ and ‘\”’)
      • Utilize the static methods of the Character class to manipulate get information about char values
    19. 3.7 Exceptions

    20. Description

      All programs have bugs at some point in the development process. Bugs are ok! They show us exactly where the problems are in our code and give us helpful information so that we can fix these problems.

      When there is a bug in your program, Java will actually provide helpful information about where the bug is and what kind of bug is occurring by throwing an Exception. In this lesson we’ll learn about the different kinds of exceptions and what they mean. That way, when we try running our programs and see exceptions, we’ll know how to use that information to debug our programs!

    21. Objective

      Students will be able to…

      • Explain the difference between a compile time error and a runtime error
      • Explain when exceptions are thrown
      • Explain the purpose of exceptions
      • Utilize exceptions to find and fix bugs in programs
    22. 3.8 String Processing

    23. Description

      We’ve learned about writing our own methods that take in parameters and return return values. We’ve learned about the relationship between Strings and characters. We’ve learned about using the methods of the String class and the Character class. We’ve learned about looping through the characters of a String using a for loop. It’s time to put that all together to write some methods that perform some advanced manipulation of Strings.

    24. Objective

      Students will be able to…

      • Synthesize the skills and concepts from learned in this unit to write methods that perform advanced manipulations on Strings and chars
      • Write out a pseudocode algorithm for a solution before diving in and writing Java code
      • Implement pseudocode solutions in Java
      • Debug their code
      • Explain the common idiom for manipulating a String:
        • Looping over each character
        • Perform some action based on each character
        • Append the resulting character to a result String that starts off as an empty String
        • Return the result String
    25. 3.9 Unit 3 Quiz

    26. Description

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

    27. Objective

      Assess student achievement of the learning goals of the unit

  4. Classes and Object-Oriented Programming

    1. 4.1 Introduction to Classes and Objects

    2. Description

      In this lesson students learn about classes and objects, the foundation of Object Oriented Programming. This lesson introduces a lot of new vocabulary, but it will be reinforced and used in concrete examples and exercises over the next several lessons.

      Students have been creating objects of the String class, they just haven’t dove into that terminology yet. In this lesson, students will learn about objects, which are things that have state and behavior, and classes, which are the templates for creating objects. Students will be creating instances of objects in this lesson.

    3. Objective

      Students will be able to:

      • Describe the relationship between classes and objects
      • Create programs that create (instantiate) multiple objects from a given class
      • Create programs that call methods on an object and print out the result
    4. 4.2 Classes vs. Objects

    5. Description

      In this lesson, students will dive deeper into the relationship between classes, objects, and instances (generally instances and objects refer to the same thing). Students will get more practice identifying classes and objects, creating objects from classes, and calling methods on objects.

    6. Objective

      Students will be able to:

      • Describe the relationship between classes, objects, and instances
        • An object is something that has both state and behavior. An object is an instance of a class
        • A class is a template for creating objects. Objects are instantiated from classes
        • Objects and instances generally refer to the same thing
      • Identify if a given thing is an object or a class
      • Create multiple objects of a given class
      • Call methods on an object to access the object’s state and behavior
    7. 4.3 Using a Class as a Client

    8. Description

      In this lesson, students learn about the overarching idea of “using a class as a client”. In Java, everything is represented as a class. Classes are a nice way of bundling up functionality. There are classes written for a lot of common needs (such as the String class and the Character class), and we can use these classes in our programs.

      When someone else creates a class, and you use the functionality of that class, that is called being a client of the class. Users don’t need to know exactly how everything works inside the class, they can just use all the functionality of that class without worrying about the inner workings. For example, you can use the String class to create String objects, and call methods on the objects to get information like the length and the characters at certain indices, without ever looking at the source code for the String class.

    9. Objective

      Students will be able to:

      • Describe what it means to be a client of a class
      • Explain the benefit of being able to use the functionality of a class without ever having to look at the source code for the class.
      • Read documentation for a class to determine what methods are available to use
      • Create programs that use other classes as a client to solve a specific problem
    10. 4.4 Writing Classes

    11. Description

      Now that students have had practice using classes without actually changing the source code for a class, they dive in and actually start writing our own classes. In this lesson, students will learn the basics of writing classes including implementing constructors, using instance variables, and writing a toString method.

    12. Objective

      Students will be able to:

      • Create their own class
      • Create a constructor for a class
      • Determine what instance variables a class should have and create them
      • Create a toString method for a class so that it can be printed out
      • Create a program that uses their own class as a client
    13. 4.5 Writing Classes and Instance Methods

    14. Description

      In this lesson, students will learn about instance methods and start adding more interesting instance methods to their classes. The instance variables define the state of an object (instance), and the instance methods define the behavior of an object (instance). Instance methods give the object new abilities, they define what the object can actually do.

      toString is one example of an instance method, it returns the instance’s (object’s) instance variables put together as a String, that way the instance can be printed out to the screen. It gives an object the ability, or the behavior, to represent itself as a String. In this lesson, we’ll start adding more instance methods to our classes.

    15. Objective

      Students will be able to:

      • Create their own classes
      • Create instance methods for their classes
      • Create objects of their class, and call instance methods on those objects (instances)
      • Describe the difference between instance variables and instance methods
    16. 4.6 Getter and Setter Methods

    17. Description

      In this lesson students will learn about a special type of instance method: getter and setter methods. Getter and setter methods give the client access to the private instance variables in a class. Programmers don’t want to make instance variables public because then the client has full access to them, and might accidentally do something that messes them up (for example, it doesn’t make sense to have a negative width or a negative height for a Rectangle object). Instead, programmers expose limited access to them through getter and setter methods. That way, they can allow only certain changes to the instance variables, and block other changes.

    18. Objective

      Students will be able to:

      • Describe what a getter method is
      • Describe what a setter method is
      • Explain the difference between getter and setter methods
      • Explain the purpose of getter and setter methods
      • Create getter and setter methods for their classes
      • Call getter and setter methods on an object to access the object’s private instance variables
    19. 4.7 Class Methods and Class Variables

    20. Description

      In this lesson students learn about Class methods and Class variables, which are different from Instance methods and Instance variables.

      Students have learned a lot about Instance methods and Instance variables. Each instance of a class has its own instance methods, and its own instance variables. For example, two different Rectangle objects can each have their own width and their own height. These values can be different from instance to instance.

      The key difference with Class methods and Class variables is that all instances share the exact same Class methods and Class variables. Each instance does not get its own copy, it is all shared among instances. These methods and variables exist at the Class level, not the Instance level.

      Class methods and Class variables are specified using the static keyword.

    21. Objective

      Students will be able to:

      • Explain the difference between instance methods and class methods
      • Utilize class methods in a program that is a client of a class
      • Utilize class variables in a program that is a client of a class
      • Write their own static class methods on their classes
      • Write their own static class variables on their classes
      • Identify a class variable / method vs an instance variable / method
      • Explain when class variables / methods would be appropriate instead of instance variables / methods
    22. 4.8 Method Overloading

    23. Description

      In this lesson students will learn about method overloading: writing several different methods, each with the same name. As long as each method’s parameter list is different, method can use the same name multiple times!

    24. Objective

      Students will be able to:

      • Describe what method overloading is
      • Explain the purpose of method overloading
      • Create classes that overload methods
    25. 4.9 Local Variables and Scope

    26. Description

      In this lesson students explore the scoping of a variable, which is where the variable is “defined” or where it exists. In this lesson getting students to define and explain the concept themselves is key.

    27. Objective

      Students will be able to:

      • Identify the scope of a variable
      • Identify which variables are in scope at a given point in a program
      • Compare two different variables and determine which has a more specific scope
    28. 4.10 Key Terms for Classes

    29. Description

      In this lesson students learn several new vocabulary terms about Classes and Object Oriented Programming. There’s a lot of vocab in this lesson, but it’s all important for the AP exam. Many of these terms students have seen before, however this lesson will describe what they mean.

      The most important term to learn is the this keyword. this is a reference to the current instance. this is used to avoid naming conflicts between instance variables and parameters.

    30. Objective

      Students will be able to:

      • Define all the Object Oriented vocabulary terms in this lesson
      • Use the this keyword to solve variable shadowing problems
    31. 4.11 Objects vs Primitives

    32. Description

      In this lesson, students learn about the difference between primitive and object variable types. So far, students have used these different variable types, but have not explored the differences between the two.

      This lesson looks at the differences between primitive and object types and discusses the implications of these differences.

    33. Objective

      Students will be able to:

      • Explain the differences between primitive and object data types
      • Properly compare variables using the correct methods
      • Explain the difference between passing a primitive vs an object to a method
      • Explain why null pointer exceptions occur and how to avoid them
    34. 4.12 Inheritance

    35. Description

      In this lesson, students learn about class hierarchy and make subclasses and superclasses. Class hierarchy is a critical part of the Java language and used to help reuse code between classes.

      Students will explore the relationships of classes in this lesson and then extend that to class design in the next lesson.

    36. Objective

      Students will be able to:

      • Describe the differences between a Is A and a Has A relationship.
      • Explain how class hierarchy helps to reuse code.
      • Create subclasses
      • Explain that the Object class is the top of the Java hierarchy
      • Demonstrate how a subclass makes a call to the superclass constructor
    37. 4.13 Class Design and Abstract Classes

    38. Description

      In this lesson, students learn about class structure and how we can further enhance that class structure with abstract classes. They will then use this knowledge to implement abstract classes.

      Abstract classes are a key concept for polymorphism. In this lesson, students will get the knowledge of how to use abstract classes, but some of the reasons why we implement them will become more apparent in the next lesson.

    39. Objective

      Students will be able to:

      • Explain what an abstract class is and why we use them
      • Implement abstract classes and subclasses
      • Explain design considerations for larger programs
    40. 4.14 Polymorphism

    41. Description

      In this lesson, students learn about polymorphism and how it applies to dynamic binding at run time. Students will also explore how polymorphism can be used as a formal parameter in methods or as a declaration type for arrays or ArrayLists.

    42. Objective

      Students will be able:

      • Explain what polymorphism is in the context of computer science
      • Explain how polymorphism can be used in the context of formal parameters
      • Explain how polymorphism can be used in the context of declaring arrays of a superclass type
      • Demonstrate the use of polymorphism in dynamic (late) binding
    43. 4.15 Interfaces

    44. Description

      In this lesson, students will learn about interfaces. Interfaces share a lot of similarities with abstract classes and part of this lesson will focus on comparing the two.

      Students will make and implement their own interfaces as well as implementing interfaces that are created by Java.

    45. Objective

      Students will be able to:

      • Implement interfaces from the Java library
      • Create and implement their own interfaces
      • Compare and contrast abstract classes and interfaces
    46. 4.16 Unit 4 Quiz

    47. Description

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

    48. Objective

      Assess student achievement of the learning goals of the unit

  5. Data Structures

    1. 5.1 What are Data Structures?

    2. 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.

    3. 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
    4. 5.2 Introduction to Arrays

    5. 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.

    6. 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
    7. 5.3 Using Arrays

    8. 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.

    9. 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.
    10. 5.4 ArrayList Methods

    11. 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.

    12. Objective

      Students will be able to:

      • Create an ArrayList
      • Add to and access ArrayList elements
      • Traverse an ArrayList
      • Use basic ArrayList methods
    13. 5.5 Arrays vs ArrayLists

    14. 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.

    15. 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.
    16. 5.6 The List Interface

    17. 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.

    18. 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.
    19. 5.7 2D Arrays (Matrices or Grids)

    20. 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.

    21. 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.
    22. 5.8 HashMaps

    23. 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.

    24. 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.
    25. 5.9 Binary

    26. 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.

    27. 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
    28. 5.10 Writing BlackJack

    29. 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.

    30. 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.
    31. 5.11 Battleship

    32. 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.

    33. Objective

      Students will be able to:

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

    35. Description

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

    36. Objective

      Assess student achievement of the learning goals of the unit

  6. Final Project

    1. 6.1 Final Project

    2. Description
    3. Objective
  7. Project: Pokemon Simulation

    1. 7.1 Pokemon Simulation

    2. Description
    3. Objective
  8. Project: Mad Libs

    1. 8.1 Mad Libs

    2. Description
    3. Objective
  9. Java Outside of CodeHS

    1. 9.1 Java Outside of CodeHS

    2. Description
    3. Objective
  10. Project: Quiz Creation

    1. 10.1 Quiz Creation

    2. Description
    3. Objective
  11. Computer Ethics

    1. 11.1 Computer Ethics

    2. Description
    3. Objective