Please enable JavaScript to use CodeHS

AP Computer Science A (Nitro)

Description

In this lesson, students are introduced to classes and objects. These are the foundations of object oriented programming.
Students will learn about objects that have state and behavior, and classes which are the templates for creating objects. This lesson corresponds with AP Computer Science A topic 2.1.

Objective

Students will be able to:

  • Explain the relationship between a class and an object
  • Create classes with instance variables
Description

In this lesson, students will create and use constructors. The constructor, or signature of a class, allows for the creation of a new object. Students will create objects by calling constructors with parameters. Parameters are values that are passed into a constructor. These are referred to as actual parameters. This lesson corresponds with AP Computer Science A topic 2.2.

Objective

Students will be able to:

  • Create and use constructors
  • Create objects by calling constructors with parameters
Description

In this lesson, students are introduced to method overloading. This is when several different methods are written, each with the same name. As long as each method’s parameter list is different, the same method name can be used multiple times! This lesson corresponds with AP Computer Science A topic 2.2.

Objective

Students will be able to:

  • Explain the purpose of method overloading
  • Create classes that overload methods
  • Explain how null objects do not point to any particular object data
  • Create programs that use other classes as a client to solve a specific problem
Description

In this lesson, students will take a deeper look into creating and calling the methods of a class. Methods are procedures that define and allow for control of the behavior of an object. Once an object is instantiated, the instance variables can be used across the different methods that are created. Students will also learn about procedural abstraction for methods that can be used without knowing all of the underlying details and code. This lesson corresponds with AP Computer Science A topic 2.3.

Objective

Students will be able to:

  • Create and call class methods
  • Call non-static void methods without parameters
Description

In this lesson, students will build on what they have learned and discover how to call a void method with parameters. Just as constructors can have parameter values, methods can have formal parameters that affect the state of the object as well. Methods can also be overloaded just like constructors! This lesson corresponds with AP Computer Science A topic 2.4.

Objective

Students will be able to:

  • Call non-static void methods with parameters
Description

In this lesson, students will learn how to call a non-void method and return a value from a method by using the keyword return. The return keyword returns a variable or value back to the existing program so it can be used further along in the program. This lesson corresponds with AP Computer Science A topic 2.5.

Objective

Students will be able to:

  • Create and call non-void methods with parameters and return values
Description

In this lesson, students will learn about the immutability of Strings as objects. Once a String object is created, it cannot be changed or manipulated. The only way to change a String value is to reassign the variable with a different String value. Students will also practice String concatenation using operators such as + and += and use escape sequences such as \” and \n. This lesson corresponds with AP Computer Science A topic 2.6.

Objective

Students will be able to:

  • Create String objects for a String class
  • Concatenate Strings using operators and escape sequences
Description

In this lesson, students will look at Strings as a sequence of characters and utilize String methods from the java.lang package. Students will learn about packages, libraries and documentation. The following String methods will be examined in this lesson:

name.length() 
name.substring(2, 6)
name.indexOf(“d”)
name.equals(“Karel”)
name.compareTo(“Karel”)

This lesson corresponds with AP Computer Science A topic 2.7.

Objective

Students will be able to:

  • Call String methods for a String class
  • Explain the importance of APIs, documentation and packages in Java

Enduring Understandings

This lesson builds toward the following Enduring Understandings (EUs) and Learning Objectives (LOs). Students should understand that…

  • EU Var-1 To find specific solutions to generalizable problems, programmers include variables in their code so that the same algorithm runs using different input values. (LO’s 1.E, 1.D)
  • EU Mod-1 Some objects or concepts are so frequently represented that programmers can draw upon existing code that has already been tested, enabling them to write solutions more quickly and with a greater degree of confidence. (LO’s 1.G, 1.F, 1.C)
Description

In this lesson, students will learn how to convert primitive types to object types using a wrapper class. They will learn how Java automatically converts types using autoboxing and unboxing. This lesson corresponds with AP Computer Science A topic 2.8.

Objective

Students will be able to:

  • Create Integer and Double objects for wrapper classes
  • Call Integer and Double methods for wrapper classes
Description

In this lesson, students will learn about static methods. Static methods are methods that can be called without creating an object. More specifically, students will discover and practice using static methods in the Java Math class. The following Math class methods will be examined in this lesson:

Math.abs(x)
Math.pow(base, exponent)
Math.sqrt(x)
Math.random()
Math.round()
Math.cos()
Math.sin()
Math.PI

This lesson corresponds with AP Computer Science A topic 2.9.

Objective

Students will be able to:

  • Call static methods
  • Evaluate expressions that use the Math class methods