AP CSA Unit 3 Class Creation: Building Objects with Constructors and Methods

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/24

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

25 Terms

1
New cards

Constructor

A special block of code in a class that runs automatically when a new object is created (with new) to initialize the object’s instance variables to a valid starting state.

2
New cards

Instance variable (field)

A variable declared in a class (outside methods/constructors) that stores an object’s ongoing state; each object has its own copy.

3
New cards

new operator

Java keyword used to create an object; it allocates memory, invokes a matching constructor, and returns a reference to the new object.

4
New cards

Constructor naming rule

A constructor’s name must exactly match the class name.

5
New cards

Constructor return type rule

A constructor has no return type at all (not even void); adding a return type turns it into a regular method.

6
New cards

Object reference variable

A variable that stores a reference (address) to an object in memory (e.g., Student s refers to a Student object).

7
New cards

Shadowing

A naming conflict where a parameter or local variable has the same name as an instance variable, causing the parameter/local name to hide the field name inside the method/constructor.

8
New cards

this keyword

A reference to the current object; used to access instance variables/methods explicitly (e.g., this.name) and to resolve shadowing.

9
New cards

Common constructor shadowing bug

Writing name = name; when a parameter shadows a field, which assigns the parameter to itself and leaves the instance variable unchanged (default value remains).

10
New cards

Default initialization

If you don’t explicitly assign a field, Java gives it a default value (e.g., numeric primitives → 0, boolean → false, references like String → null).

11
New cards

No-argument constructor (no-arg constructor)

A constructor with no parameters (e.g., public Student() { ... }) used to create objects with default/placeholder starting values.

12
New cards

Automatic default constructor rule

If a class defines no constructors, Java provides an automatic no-arg constructor; if you define any constructor, Java does not add a no-arg constructor for you.

13
New cards

Constructor overloading

Having multiple constructors with the same name (class name) but different parameter lists so objects can be initialized in different valid ways.

14
New cards

Parameter list matching (constructor selection)

When you call new ClassName(...), Java chooses the overloaded constructor whose parameter types/number best match the arguments provided.

15
New cards

Constructor chaining with this(...)

Calling another constructor in the same class from within a constructor (e.g., this(name, 9);) to reuse initialization logic and avoid repetition.

16
New cards

this(...) first-statement rule

If a constructor calls this(...), it must be the first statement in that constructor.

17
New cards

Method

A named block of code in a class that defines behavior (actions/computations) and is executed only when called.

18
New cards

Method signature

The method’s identifying header information used for overloading: method name plus parameter types (not the return type).

19
New cards

Access modifier

A keyword like public that controls where a constructor/method can be accessed (e.g., public means callable from outside the class).

20
New cards

Local variable

A variable declared inside a method/constructor (including parameters) that exists only while that method/constructor runs.

21
New cards

Dot notation (method call syntax)

Calling an instance method on an object using object.methodName(...); the object is the “receiver” of the call.

22
New cards

void method

A method that performs an action but returns no value; it must be called as a standalone statement, not used where a value is required.

23
New cards

Return statement

A statement that immediately ends a method; in non-void methods it also provides a value back to the caller, and all possible paths must return a value.

24
New cards

Accessor method (getter)

A method (often public, non-void, usually no parameters) that returns information about an object’s state without changing it (supports encapsulation).

25
New cards

Encapsulation

An OOP practice of keeping fields private and providing controlled access through methods (e.g., getters) to protect data and maintain valid object state.

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)