Chapter 4 - Methods use instance variables Flashcards
Point of an object
Has behavior that acts on it’s state
Methods use
Instance variable values
A method uses
Parameters
A caller passes
Arguments
What do you have to do if a method takes a parameter
You must pass it a value of the appropriate type
Arguments are
The things you pass into methods
A parameter is nothing more than
A local variable with a type and a name that can be used inside the body of the method
An example of an argument
d.bark(3); <— 3
An example of a parameter
void bark (int numOfBarks) <—numOfBarks
What does void mean?
Methods do not return anything back
Can methods have multiple parameters?
Yes. t.takeTwo(12, 34);
Java is?
Pass-by-value
What does pass-by-value mean
Pass-by-copy
Call the go()method, passing the variable x as the argument
foo.go(x);
Value means?
bits inside the variable. A variable is a reference to an object.