Please enable JavaScript to use CodeHS

Chapter 5

Writing Classes

5.3 Documentation with Comments

Introducing Comments

Multi-line comments

Single line comments

Preconditions and postconditions

Power Class with Comments

Comments for Debugging

Check Your Understanding

  1. Incorrect Correct No Answer was selected Invalid Answer

Exercise: Commenting Activity Tracker

Vocabulary

Term Definition
Preconditions Conditions that must be true prior to execution in order for that code segment to behave as expected.
Postconditions Conditions that must be true after the code segment is executed.