Please enable JavaScript to use CodeHS

AP Computer Science A (Nitro)

Lesson 5.1 Writing Classes

Description

In this lesson, students will explore and learn the anatomy of classes. They will take a deeper dive into what the access specifier does, and how it can be used within programs to make data public or private. Students will learn about encapsulation and the responsibility programmers have to choose whether data should be accessible, modifiable, both or neither. This lesson corresponds with AP Computer Science A topic 5.1.


Objective

Students will be able to:

  • Designate access and visibility constraints to classes, data, constructors, and methods
  • Designate private visibility of instance variables to encapsulate the attributes of an object