Unit 3 Mastery: Class Creation Essentials

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

Last updated 8:36 PM on 3/4/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

26 Terms

1
New cards

Constructor

A special block of code in OOP that initializes the instance variables of an object.

2
New cards

Instance Variables

Attributes that hold the state of an object.

3
New cards

Name Match

Rule stating that a constructor's name must match the class name.

4
New cards

No Return Type

Constructors do not have a return type, not even void.

5
New cards

Automatic Call

Constructors are called automatically when using the new keyword.

6
New cards

No-Argument Constructor

A constructor that takes no parameters and sets instance variables to default values.

7
New cards

Parameterized Constructor

A constructor that accepts parameters to set instance variables to specific values.

8
New cards

Constructor Overloading

Having more than one constructor in a class with different parameter lists.

9
New cards

Default Constructor Trap

If a class has any constructor, the default no-argument constructor is no longer provided by Java.

10
New cards

Method Header

Defines how code interacts with the method consisting of the access specifier, return type, method name, and parameter list.

11
New cards

Access Specifier

Determines the visibility of a method, usually public or private.

12
New cards

Return Type

Indicates the type of data returned by a method.

13
New cards

Method Name

Follows camelCase convention and describes the action of the method.

14
New cards

Parameter List

Variables listed in parentheses that act as local variables within the method.

15
New cards

Method Signature

Consists of the method name and parameter list only, excluding return type.

16
New cards

return Statement

Used in methods with a return type to return a value and halt method execution.

17
New cards

Accessor Methods

Public methods that allow controlled access to private instance variables.

18
New cards

Encapsulation

The principle of keeping instance variables private and exposing them via public methods.

19
New cards

Pass-by-Value

When parameters are passed to a method, a copy of the value is passed.

20
New cards

Primitives

Basic data types like int, double, etc., where a copy of the value is passed.

21
New cards

Objects

References to objects are passed by value, allowing modifications to the object's state.

22
New cards

Common Pitfall: void Constructor

Adding void to a constructor declaration makes it a method instead.

23
New cards

Shadowing Variables

Naming a parameter the same as an instance variable without using 'this' to differentiate.

24
New cards

Unreachable Code

Code placed after a return statement which can never be executed.

25
New cards

Header vs. Call Confusion

Confusing method header with method call syntax.

26
New cards

Method Call Example

Correctly calling a method without type declarations like myObject.add(5, 10).

Explore top notes

note
Tsunamis
Updated 697d ago
0.0(0)
note
The Great Gatsby
Updated 771d ago
0.0(0)
note
26.2 History of Life on Earth
Updated 1797d ago
0.0(0)
note
Cetaceans - Marine Biology
Updated 1780d ago
0.0(0)
note
RIse of Democracy Vocab Pt. 3
Updated 1522d ago
0.0(0)
note
types of dimensions note
Updated 1522d ago
0.0(0)
note
Tsunamis
Updated 697d ago
0.0(0)
note
The Great Gatsby
Updated 771d ago
0.0(0)
note
26.2 History of Life on Earth
Updated 1797d ago
0.0(0)
note
Cetaceans - Marine Biology
Updated 1780d ago
0.0(0)
note
RIse of Democracy Vocab Pt. 3
Updated 1522d ago
0.0(0)
note
types of dimensions note
Updated 1522d ago
0.0(0)

Explore top flashcards

flashcards
faf
40
Updated 980d ago
0.0(0)
flashcards
faf
40
Updated 980d ago
0.0(0)