(T/F) In UML class diagrams, the same kind of arrow is used when a class refers to an interface it implements, and when it refers to another class the original class extends
False
this
What keyword do you need to have a class make a "contract" with an interface?
implements
What class is the default abstract class that gets extended?
Object
What two functions must be overridden to use a HashSet or Hashmap?
int hashcode();
boolean equals(Object o);
In what two situations is toString automatically called?
System.out.println();
String Concatenation
What is a Constructor and are they mandatory?
A constructor is a method and sets the fields and creates a new object of the type of that object. It doesn't need a return type and is not mandatory.
How many Interfaces can you implement with one class?
Infinite
What problem in coding does abstraction solve?
Duplicate code due to common behavior between classes.
What is something you must do in order to use a tree set with the object's natural ordering and a user set order?
Natural Ordering: make the object comparable and implement its function.
User set order: make a comparator and implement its function
What key words are used for each of these arrows?
Extends
Implements
Extends
What keyword should all of your fields be and why?
private
Other classes should not have access to your fields.
final
You can instantiate an abstract class, True or False.
False
Time Complexity for contains for these three classes:
TreeSet, HashSet, ArrayList
TreeSet: O(log(n))
HashSet: O(1)
ArrayList: O(n)
Make a HashSet to store Strings.
Set<String> madeSet = new HashSet<>();
Write a Java class about a book.
3 fields: name, price, author
3 methods:getName, getPrice, equals

What keyword is used to declare a method but leave the implementation to the child classes?
abstract
If a parent class has a constructor with parameters, what must a child class do and what keywords are necessary?
The child class must call the parents constructor with its parameters with the super keyword.
What is the signature for implementing Comparable and Comparator for an object Person by age, assuming it has a method called getAge.
Comparable:

Comparator:

Given an abstract class with no declared fields and all abstract methods, why not just use an interface? When would you want to use an interface or abstract class?
Abstract: When you want access modifiers beside public + classes that inherit from abstract class are all closely related
Interface: When you expect wide array of classes will implement + take a class can implement multiple
What is static?
Static methods and variables don't belong to the object but to the class. Don't need an object of that type to use static methods or variables.
What is a generic type? Give an example of a generic class declaration with type parameter.
Generic class or interface that is parameterized over types
Example of generic class:
public class Box<T> { }
Write an Abstract Class for a Person:
3 fields: name, age, alive
6 methods:
Constructor: default alive
getName, birthday, speak, cook
toString: form: "Person{name='Kevin', age=20, alive=true}"

Daily Double!!!!
Try and draw the entire JCF. Whichever team draws the most accurate and biggest picture of the JCF wins this point and probably the game.
