AP® Computer Science A glossary

Behavior

Course: AP® Computer Science A Shows up in: Unit 1: Using Objects and Methods

What instances of a class can do, or what can be done with them, defined by methods, such as grow or getHeight.

Appears in the course and exam description (CED): 1.7.A.2

Behaviors are the verbs of a class. Each behavior is defined by a method, and calling the method makes the object do it.

Plant fern = new Plant("Fern", 30);
fern.grow(5);   // a behavior
System.out.println(fern.getHeight());

Output:

35
Learn it properly, with a checkpoint 1.7 Application Program Interface (API) and Libraries

Related terms

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

↑ Top

Enlarged view of the selected figure