AP CSA Study Notes: Building Your Own Java Classes (Class Creation)

0.0(0)
Studied by 0 people
0%Unit 3 Mastery
0%Exam Mastery
Build your Mastery score
multiple choiceMultiple Choice
call kaiCall Kai
Supplemental Materials
Card Sorting

1/49

Last updated 3:08 PM on 3/12/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

50 Terms

1
New cards

Class

A programmer-defined type in Java that bundles data (state) and operations (behavior); a blueprint for creating objects.

2
New cards

Object

An entity created from a class (typically using new) that has its own state and can perform behaviors via methods.

3
New cards

Instance

A specific object created from a class; each instance has its own copy of the class’s instance variables.

4
New cards

State

The information an object stores, represented by its instance variables (fields).

5
New cards

Behavior

The actions an object can perform, implemented by methods.

6
New cards

Instance Variable (Field)

A per-object variable that stores state; each object has its own separate copy.

7
New cards

Method

A named block of code in a class that can read/change object state and/or return a value.

8
New cards

Constructor

A special block of code that runs when an object is created to initialize instance variables; same name as class and no return type.

9
New cards

Instantiation

The process of creating an object from a class, typically using the new keyword.

10
New cards

new Keyword

Java keyword used to create a new object and run its constructor.

11
New cards

Primitive Type

A basic built-in type like int, double, boolean (not an object reference).

12
New cards

Encapsulation

Design principle of hiding an object’s data with private fields and providing controlled public methods to interact with it.

13
New cards

Access Modifier

A keyword like public or private that controls where a class/member can be accessed from.

14
New cards

public

Access level meaning usable from outside the class; commonly used for constructors and methods meant for other code to call.

15
New cards

private

Access level meaning accessible only within the same class; commonly used for instance variables to protect state.

16
New cards

Class Invariant

A rule/condition that should always be true for a valid object (e.g., balance not negative, hours 0–23).

17
New cards

Accessor (Getter)

A method that returns information about an object without changing its state (e.g., getBalance()).

18
New cards

Mutator

A method that changes an object’s state (e.g., deposit, withdraw, setAge).

19
New cards

Validation

Checking inputs (often in mutators/constructors) to prevent an object from entering an invalid state.

20
New cards

Method Signature

The method name plus parameter types (and in AP practice, you closely track return type as well).

21
New cards

Return Type

The type of value a method promises to return (or void if it returns nothing).

22
New cards

void Method

A method that performs an action but returns no value; its result cannot be used in an expression.

23
New cards

Parameter

An input to a method/constructor; a local variable that exists only during the call.

24
New cards

Local Variable

A variable declared inside a method or block that exists only within that method/block.

25
New cards

Scope

The region of code where a variable can be used (e.g., a variable declared in an if block can’t be used after the block).

26
New cards

Side Effect

A change that persists after a method finishes, such as updating an instance variable.

27
New cards

this Keyword

A reference to the current object whose method or constructor is executing; used to refer to fields explicitly.

28
New cards

Shadowing

A bug-prone situation where a parameter/local variable name is the same as a field name, hiding the field within that scope.

29
New cards

Constructor Overloading

Providing multiple constructors with different parameter lists to support different valid ways to create an object.

30
New cards

No-Argument Constructor

A constructor you explicitly write with no parameters (e.g., public Point() { ... }).

31
New cards

Default Constructor

A no-argument constructor Java automatically provides only if you write no constructors at all.

32
New cards

Constructor Chaining (this(...))

Calling one constructor from another in the same class using this(...); it must be the first statement in the constructor.

33
New cards

static

Keyword indicating a member belongs to the class itself (shared), not to individual objects.

34
New cards

Static Variable

A class-level variable with one shared copy across all instances (e.g., counting how many objects were created).

35
New cards

Static Method

A class-level method that has no implied this and cannot directly access instance variables without an object reference.

36
New cards

static final Constant

A shared, unchangeable value (constant) used to avoid “magic numbers” (e.g., public static final double PI = ...).

37
New cards

Public API

The set of public constructors/methods a class exposes so other code can use it without accessing internal fields.

38
New cards

toString Method

A method that returns a String representation of an object; used automatically when printing an object reference.

39
New cards

Overriding

Providing a new version of a superclass method (like toString) with the same header to customize behavior.

40
New cards

@Override Annotation

Optional marker that helps catch mistakes when overriding; causes a compile-time error if the method doesn’t correctly override.

41
New cards

String Concatenation

Building strings using + (often in toString); formatting must match required output exactly.

42
New cards

Reference Variable

A variable that stores a reference (not the whole object); it points to an object in memory.

43
New cards

Aliasing

When two reference variables point to the same object; changes through one reference are visible through the other.

44
New cards

null Reference

A reference value meaning “no object”; attempting to call methods on it causes a runtime error.

45
New cards

NullPointerException

Runtime error that occurs when code tries to use a null reference as if it referred to an object.

46
New cards

== (Reference Equality)

For objects, checks whether two references point to the exact same object (identity), not whether contents match.

47
New cards

.equals(...) (Logical Equality)

A method (in many classes) used to compare object contents/meaning rather than reference identity.

48
New cards

Pass-by-Value

Java argument passing rule: methods receive copies of values; for objects, the copied value is the reference (so the object can still be mutated).

49
New cards

Driver/Tester

A separate class/program (often with main) used to construct objects and call methods to verify behavior.

50
New cards

Tracing Object State

Following how instance variables change across a sequence of statements/method calls, especially with multiple objects or aliasing.

Explore top notes

note
Invisible Man Chapter 1
Updated 1173d ago
0.0(0)
note
Media & Information Literacy
Updated 322d ago
0.0(0)
note
Invisible Man Chapter 7
Updated 1173d ago
0.0(0)
note
Unit 3 : Macromolecules
Updated 313d ago
0.0(0)
note
International Cooperation
Updated 1195d ago
0.0(0)
note
Biochimie
Updated 746d ago
0.0(0)
note
Invisible Man Chapter 1
Updated 1173d ago
0.0(0)
note
Media & Information Literacy
Updated 322d ago
0.0(0)
note
Invisible Man Chapter 7
Updated 1173d ago
0.0(0)
note
Unit 3 : Macromolecules
Updated 313d ago
0.0(0)
note
International Cooperation
Updated 1195d ago
0.0(0)
note
Biochimie
Updated 746d ago
0.0(0)

Explore top flashcards

flashcards
S.S. Unit 3 - Study Guide
57
Updated 126d ago
0.0(0)
flashcards
Chapter 27
120
Updated 705d ago
0.0(0)
flashcards
Lit Words: 2 The Boogaloo
24
Updated 496d ago
0.0(0)
flashcards
Lab Practical 3
75
Updated 755d ago
0.0(0)
flashcards
Polyatomic Ions
21
Updated 768d ago
0.0(0)
flashcards
Latin Week 5
26
Updated 920d ago
0.0(0)
flashcards
Connect 4, Unit 3
52
Updated 1011d ago
0.0(0)
flashcards
S.S. Unit 3 - Study Guide
57
Updated 126d ago
0.0(0)
flashcards
Chapter 27
120
Updated 705d ago
0.0(0)
flashcards
Lit Words: 2 The Boogaloo
24
Updated 496d ago
0.0(0)
flashcards
Lab Practical 3
75
Updated 755d ago
0.0(0)
flashcards
Polyatomic Ions
21
Updated 768d ago
0.0(0)
flashcards
Latin Week 5
26
Updated 920d ago
0.0(0)
flashcards
Connect 4, Unit 3
52
Updated 1011d ago
0.0(0)