Please enable JavaScript to use CodeHS

AP Computer Science A (Mocha)

Lesson 4.12 Objects vs Primitives

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.


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