1/11
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
AccessorGetter
// returns a data field
public int getSlices() {
return slices;
}
Arguments
// values passed to a method
public void setColor (String s) {
color = s;
}
Class
// code that describes an object
Constructor
code that creates an object, sets the data fields
// public Pizza(String t, int s) {
topping = t;
slices = s;
}
Default constructor
Code that creates an object, NO ARGUMENTS/PARAMETERS
Instance variable / data field
// characteristics of the object; what each object knows about itself
public class Dog {
private String name;
private int age;
}
***the stuff inside class Dog are always private, declared at the beginning of a class
Instantiation
// creation of an object, uses the word new, happens in a driver class
Dog fred = new Dog(“fred“, 8);
Local variable
variable that exists only in one section of code
Ex. a var created in a loop or method
Setter/Mutator/Modifier
// changes the value of a data field
public void setNum(int n) {
num = n;
}
Null
the state of an object before it is instantiated
Noodle ramen;
this above is NULL ^^^
Noodle ramen = new Noodle(“Korean”, 5);
Object
a specific instance of a class created in a driver
Pizza mushroom = new Pizza…
Pizza pepperoni = new Pizza…
mushroom and pepperoni are Pizza objects
Primitive
just a value, no built in methods
int x = 5;
double y = 3.14;
boolean z = false;