Chapter 2 Flashcards
What 5 benefits do we get from raising the abstraction of our code
1) Easier to write the program
2) Easier to understand.
3) Easier to debug.
4) Easier to modify.
5) We can create commands that may be reused.
SubClass vs SuperClass
superClass is the class that is higher up and the subClass inherits services from a superClass
What does calling super(); in a constructor do?
This will tell the constructor to look in a superclass for a constructor with the same parameters.
Define an implicit parameter
Is the object receiving the message, and allows us to use the “this” keyword.
Define inheritance hierarchy
It is the hierarchy of the classes that extend each other, it will include the highest superclass and the lowest subclass.
What 3 steps are involved in extending a class?
1) Create a new class that extends a class
2) Create a cosntructor for the new class that has the same name as the class.
3) Add a method for each of the services the new class should offer.
4 practices used by programmers concerning white space?
1) Begin each statement on a new line
2) Include at least one blank line between blocks of code with different purposes.
3) Line up curly braces so that the closing one is directly below the opening one.
4) Indent everything inside a pair of braces.
What is a special symbol?
Include braces, periods, semicolons, parantheses
What is a reserved word (keywords)?
Have a special meaning to the compiler ex) int, import, public
What is an identifier?
Are names of variables, classes, services, and packages
Define overriding a method.
Modifying a method from a superclass to meet your needs.
What 3 things do you need to do to override a method?
You need to create a method with the same name, return type and prarameters in the subclass.
Define recursion?
When a method calls itself.