Unit 2: Using Objects Flashcards
A _____ is an instance of a class with defined ______
object, attributes
A _____ is the formal implementation, or blueprint, of the attributes and behaviors of an object
class
Used to initialize the attributes of an object
constructor
information passed/declared for a constructor within its parentheses
ex. public Person (int height, String name, boolean home)
formal parameters
keyword used to make a new object
new
A ____ has no parameters and sets the instance variables for the object to default values
no-argument constructor
ex. Dog ted = new Dog();
The value an initialized variable has, or can be as a placeholder
null
Define the behaviors for all objects of a class and consist of a set of instructions for executing the behavior
methods
Methods that don’t have return values, so they just perform a action
void methods
constructors with the same name, but different parameters
overloading constructors
(CANNOT have two with the exact same parameters and name)
Methods that return a value that is the same type as the value given to manipulate (saved as variable, DOES NOT print calculation)
non-void methods
ex. average = calculation for average;
return average;
String objects are _____.
immutable (no method can change the value of that particular String object)
command to print a new line in java in a string
\n
value returned by indexOf() method if string doesn’t contain letter/phrase
-1
String method that returns a substring from the first index value to the last index value minus 1
String substring(int from, int to)