Please enable JavaScript to use CodeHS

AP Computer Science A (Mocha)

Lesson 2.5 Casting

Description

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


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