Please enable JavaScript to use CodeHS

AP Computer Science A (Nitro)

Lesson 2.8 String Methods

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)