1/27
AP CSA Runestone Unit 3 3.5-3.9 Vocabulary
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Instance Variables
define the attributes or data needed for objects
Methods
A block of code that performs a specific task. Defined inside a class and can access the instance variables of the class
Constructors
initializes the instance variables when the object is created
Object of the Class
Declare an object of your class in the main method or from outside the class.
Method Call
whenever you want to use the method, call objectName.methodName();
Method Definition
Write method header like following: public void methodName()
Return Statement
returns a variable’s value or an expression
Return Type
Type of value in the return statement that replaces the keyword void. Examples are String, int, double, and boolean.
Void Method
Does not return a value
Non Void Method
Returns a value
Return by Value
a return expression compatible with the return type is evaluated, and the value is returned
Accessor Method (Getter)
allows objects of other classes to obtain a copy of the value of instance variables or class variables. Is a non-void method.
Mutator (Modifier) Method/ Setter
a method that changes the values of the instance variables or class variables. It is often a void method.
Parameter
a variable in a method’s header that is used to pass in data that the method needs to do its job
Arguments
a value that is passed into a method when the method is called. It is saved into a parameter variable.
Anonymous Objects
When we create a new object without associating it with a variable
Call By Value
Used when it passes arguments to methods. This means that a copy of the value in the argument is saved in the parameter variable. It initializes the parameters with copies of the arguments. If the parameter variable changes its value inside the method, the original value outside the method is not changed.
Aliases
When two object references reference the same object
Mutable
their instance variables can change after they are constructed
Static or Class Methods
Methods that belong to the class and not to any object of the class
Static or Class Variables
Belong to the class, with all objects of a class sharing a single copy of the class variable and they use the keyword static
Final Keyword
Used in front of a variable declaration to make it a constant value that cannot be modified. Constants are traditionally capitalized.
Scope
Defined as where a variable is accessible or can be used. The scope is determined by where you declare the variable when you write your program.
Class Level Scope
instance variables inside a class
Method Level Scope
local variables (including parameter variables) inside a method
Block Level Scope
loop variables and other local variables defined inside of blocks of code with { }
Local Variables
Variables declared in the headers or bodies of blocks of code. Local variables can only be accessed in the block in which they are declared. Local variables that are declared inside a method are usually declared at the top of the method.
This Keyword
Acts as a special variable that holds a reference to the current object- the object whose method or constructor is being called. It can only be used in instance methods and constructors.