1/20
Looks like no tags are added yet.
What is the goal of a constructor?
It is a compact way to initialize objects
Benefits of constructors
Initialization is done before object can be used
Initialization can be parametrized

Explain all the arrows from top to bottom

What is the difference between a constructor and a method
a constructor has no return type, not even void
a constructor has the same name as the class
a constructor can only be called at construction
a constructor can not be inherited
In one class there can be several constructors, as long as?
They have different parameter lists (as there can be methods with the same name and different parameters)
When a class has no constructor declarations
a constructor without parameters and an empty body is generated, called the default constructor
What does overloading mean
Using the same method name to do the same thing but with different parameter types
Explain Local Variables
Variables declared in a method are local to that method
Explain Instance variables
Variables declared outside the methods, i.e., at class level, are accessible for all methods
What are the 3 kinds of variables
Instance Var ( Scope is all methods in class ) - auto initialization
Parameters ( Scope is one method only ) - initialization by call
Local Var ( Scope is one method or less ) - initialization required
Scope of parameters
They are also local to their methods
What does the private keyword do?
Prevents access to instance variables
What is a reference?
It s a unique id each java object has
What is aliasing?
When you attribute to the same object to different names such as Object c = new Object() and b = c
What is the caveat for primitive types
Aliasing is not possbile
An object can only be assigned to a reference variable
Of its own type or one of its superclasses
When using inheritance what aspects of parent class are copied?
Existing instance variables and methods of parent class

Explain what the red and blue arrows mean
Blue Arrow - Has a relation ( Tax Inspection has gardens )
Red Arrow - Is a relation
When talking about inheritance what is not copied
Constructors
What does overriding mean?
Changing methods in subclass that belong to the super-class
How do you access the old method after overriding?
super.oldMethod()